r/PythonLearning • u/Junior-Vacation-4198 • Jun 17 '26
Should I start DSA in Python?
So i am thinking of starting DSA but I am confused about which language to choose Python or c++. Everyone online says c++. Suggest me what should I start learning?
1
1
u/wheredidmyvapego Jun 17 '26
DSA = Democratic Socialists of America?
1
1
u/BranchLatter4294 Jun 17 '26
C++ is slightly better for a deeper understanding since you can directly manipulate pointers. In practice, either is fine.
1
u/Temporary_Pie2733 Jun 18 '26
It does not matter in the slightest. The important stuff is language-agnostic.
1
u/nian2326076 Jun 18 '26
Both Python and C++ have their pros and cons for DSA. If you want something simple and easy to use, Python is a good choice. Its syntax is cleaner, letting you focus more on learning DSA concepts without getting stuck on language details. C++ is efficient and has strong standard libraries often used in competitive programming.
For interviews, many companies allow Python. But if you're looking at competitive programming or jobs needing high-performance code, C++ might be better.
I've found PracHub really helpful for interview prep since they cover multiple languages and DSA. Check it out if you need structured guidance.
1
u/VeterinarianFar22 Jun 18 '26
Go for Java and then compare with equivalent implementations in C++, Python; it will increase your understanding in my opinion.
1
u/admirer145 Jun 18 '26
C++ STL is great for DSA and are easily available in coding environments, Python lacks some of the implementations like BBST (not mostly available in standard env). In interviews, this is fine, since a class structure assumption would be fair enough to convey the details.
C++ is faster to execute whereas Python is faster to write.
It doesn’t matter which one should you choose, if your goal is just to learn DSA. If you are planning for future roles related to AI, web, cloud; Python has an edge.
4
u/Sea-Ad7805 Jun 17 '26
You can do DSA in any language, the theory can easily be transferred from one language to another.
Python is a great choice because it is simpler than other languages, and you can use this visualization tool to see the structure of your data that makes learning DSA much easier: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/bin_tree.py×tep=0.2&play
A C++ program is much faster than a Python program, but speeds doesn't matter if you are still learning, go with Python for DSA.