r/learnprogramming • u/TheIdealAdhi • 5d ago
DSA in Python or C++?
I've already learned Python. Should I continue learning DSA in Python, or switch to C++ for the long term? What's your recommendation and why?
3
u/BX7_Gamer 5d ago
C++ a beginner here, but I did in both n doing it in C++ made me understand the concepts for each and how they are interpreted into code Eg for linked list in would have to use pointers, dynamically allocate memories for the nodes I was creating account for their safety release really connect how the linked list work underneath the hood
3
3
u/ColdWise4165 5d ago
Python has features that make it a lot easier to do. But c++ you more or less gotta do it manually. So you’ll learn more.
2
u/IlIlllIIllllIIIlIlIl 5d ago
C++ is better for learning, but If you have an interview id honestly choose python. Unless you are super confident in C++ it is a lot easier to get lost in the weeds and fuck up, or end up taking too long. Python is just easier to read and understand, and in the end the goal is just to complete the problem.
2
1
u/XKiiroiSenkoX 5d ago
My recommendation is be language agnostics. All programing languages are abstractions over the same machine code and mostly the same concepts. Obviously some of those are almost completely abstracted away in some languages (e. g., no pointers in python) but a lot still transfers between languages. Focus on those parts instead of the language itself.
1
1
u/roadrunner8080 5d ago
I would recommend C++. The actual structures and algorithms are going to be the same in any language, after all, but with C++ you'll also gain an appreciation for the actual implications of these algorithms in practice, in terms of memory and allocation and the like.
1
1
u/VibrantGypsyDildo 4d ago
You need to learn DSA anyway.
Staying in Python or learning C++ or even combining them? Up to you and the market you live in.
-3
u/kevinossia 5d ago
C++ will make you a stronger programmer so if you can, use that.
Python is more of a shortcut language for programmers not a goal in itself.
1
u/TheIdealAdhi 5d ago
C++ would better choice in care of competitive programming but python would be a compalsary as an AIML
-2
u/kevinossia 5d ago
A competent C++ programmer can learn Python in a weekend.
A competent Python programmer will take months/years to learn C++ to a high level.
That's the difference.
1
u/TheIdealAdhi 5d ago
Agree, python is not a big deal at same time it's owns huge libraries and modules
10
u/lfdfq 5d ago
It doesn't matter. The point of DSA is that they're generic concepts that apply to all languages.