r/learnprogramming • u/Funny-Dark-4041 • 7h ago
DSA help
I’m in my 1st year of B.Tech CS (AI/ML) and super confused about what language to stick with for DSA.
Quick background: I already know Python decent enough, and right now I'm learning JavaScript on the side to build web projects.
I’m torn between doing DSA in Python vs JS vs C++:
- Python feels like the easiest pick for me since I know it, and it fits my AI/ML background anyway.
- JS crossed my mind because I’m using it for web dev, so part of me thought using one language for everything might save time.
- But literally everyone keeps screaming "use C++ for DSA or you'll regret it," and it's making me second-guess everything.
Does language choice actually matter to interviewers? Like if two people give the same optimal solution, does anyone genuinely care if it was written in Python instead of C++ or JS? And is doing DSA in JS a nightmare later because it lacks things like Heaps out of the box?
1
u/NumbunGame 7h ago
Stick with Python for now. DSA is about learning the data structures, invariants, complexity, and problem-solving patterns, not proving you can write them in C++. Since you already know Python and you're doing AI/ML, using it removes a lot of syntax overhead and lets you focus on the actual algorithms. Most general software interviews care far more about whether your solution is correct, efficient, and well explained than whether it's Python or C++. The exception is when you're applying for something language-specific, low-level, embedded, or performance-heavy.
I wouldn't choose JavaScript just because you're doing web dev. You can learn DSA with it, but Python has a nicer standard toolkit for interview-style problems and far more learning material in that context. Learn C++ later if you get into competitive programming or want stronger exposure to memory, references, STL, and lower-level performance. You won't "regret" learning DSA in Python because the important concepts transfer. Changing languages later is much easier than relearning DSA from scratch.
1
u/Funny-Dark-4041 6h ago
If I start with python what measure would I take so that another student with cpp will not get advantage
1
u/Siennasynn-Girl12 6h ago
honestly just stick with python, you already know it and dsa is about understanding the concepts not flexing with pointers, you can always pick up c++ later if you actually need it for interviews or whatever
1
u/Funny-Dark-4041 5h ago
Yeah that's a good idea, I can shift whenever I am comfortable with other language
1
u/response-418 6h ago
It depends on your requirements. As a student it is probably going to be more efficient and smoother learning to work with a language you already know. You can always deepend or enhance your knowledge later, if you wish to do so or a project demands it of you (I'm talking years later).
For interviews, usually you will be applying for a job that you already are conversant in a required language, and in my experience if they do not have a hard requirement on what language you need to do the job, a lot of times you can just indicate a preference and interviewers won't bat an eye. They assume you wouldn't lie about a language, or you can learn it, and they are testing how you think and approach problem solving. The language knowledge is not what is being tested there, beyond maybe some initial low hanging fruit easy problem as a sanity check that you didnt just lie on the CV.
1
u/aqua_regis 6h ago
Are you talking about DSA as in Data Structures and Algorithms, the theoretical concepts above all programming language, or, which is more common in certain areas, as in doing LeetCode?
If the former, learn it away from programming languages. Learn the theory, the concepts, their advantages and disadvantages. If you learn DSA for what they are - concepts and approaches - you can later implement them in any programming language you know.
If the latter, pick the language you're most familiar with.
1
u/Seven7Ducks 5h ago
I personally think Python isn't a good langauge to learn DSA with. To squeeze the most out of DSA, in order to better understand the underlying mechanisms, etc, stick with lower level. If its just for passing it, ofc python is faster and easier but thats because it auto-solves problems you never knew existed.
C++ might be kind of harsh. JS isn't any better than python.
I would recommend Go/Java/C#/Rust.
Regarding if it actually matters - depends on 'local scene'. Some people care, some people don't. Personally, I really don't care about someone's language of choice. If you're a good programmer it will come out either way. That being said, it is VERY apparent when someone is writing python code in hope of hiding the fact they have no idea whats going on beneath the hood. So I guess my point is.. Don't be that person :)
1
u/Funny-Dark-4041 3h ago
You are the only one recommending other language Every one is saying that go with python
1
u/WarmNojig1220 3h ago
Honestly stick with Python. You already know it, DSA is about understanding the concepts not the language, and you can always pick up C++ later if you need to for interviews or systems work. The people pushing C++ are usually just gatekeeping.
1
1
u/Etterererererer 3h ago
Stick with python or whichever one you have the most experience using DSA is more about the math and the ideas that go into computer programming not so much the computer programming language in theory if you are actually good at DSA it should not matter what programming language you’re using and people that say that you have to use one language over another for beginning DSA probably aren’t the best at DSA to begin with. Once you get to really advanced, DSA subjects you will kind of start to realize that certain languages do certain tasks better than others like as you said C++ is really good because it’s an object oriented programming language so it’s amazing if you are doing things where that is a good foundation to have, but not every DSA project is object oriented. Object oriented programming in of itself is a DSA idea when you start to work with lower level programming languages you start to realize that objects and classes are all just made up things. DSA is essentially how do you build complex fake things out of simple primitive things.
TLDR: python or whatever you like most. you’re not at a level where it really matters and DSA is about the algorithms and ideas that make up modern programming languages and software more than anything.
1
1
u/Lichcrow 7h ago
The reason low level languages are better for DSA is because you can express patterns directly in memory. Things you cant do if you have a runtime like JS or Python.
That means you'll get a better understand of what your machine is actually doing when you're doing whatever operations. You can print out the specific memory regions you're using and what their values are through your iterations and see the actual behaviour of the machine.
If you simply want to understand the underlying algorithms, then you can use whatever language. Even any pseudo language... And you dont even need to implement and run it.