Learning DSA on C vs C++

Hi, I am new to the world of coding and i’ll start college in a month. I have a pretty good command over basic C which I learnt to clear my concepts like pointers, memory allocation etc before moving on to a higher level language.

I wanted to learn C++ after C but I moved on to Java as it’s in my first year syllabus along with Python and I would like to have a decent grasp on that language by the time I enter college in order to make my life a lil bit easier.

Now, my main doubt/dilemma is: I know that I have to learn DSA. Should I learn it in C after doing Java or wait till I learn C++ and then learn DSA on that?

There are many trains of thought on this as people say that learning DSA on C will make you understand them really well while some say that concept clarity is also achieved in C++ while making your life easier using it’s functions like STL.

Thank you !

1 Like

Learning DSA in C++ is much easier than learning it in C. C++ has the Standard Template Library (STL) which has in-built Containers, Iterators and Algorithms. You don’t have these things in C, so you’ll have to implement them on your own for every question which is clearly not feasible. So, you should choose C++ as it will help you a lot!
Note: It’s good to know how the inbuilt Containers and Algorithms work but you should not choose to implement it in every question.

I suggest you try it using \text{C} first. You’ll learn how to write \text{C ``Structs"} to implement different data structures and also the importance of free(). Moreover, you’ll also find some hiring tests assessing candidates’ knowledge in implementing Data structures in \text{C} (usually \text{MCQs}).