I already know Python and want to start studying data structures and algorithms. Should I continue with Python, or switch to C++ for better long-term results? I'm especially interested in understanding the concepts deeply, improving as a programmer, and knowing whether the choice matters for competitive programming or technical interviews.
4 Answers
Since you already know Python, continuing with it is completely reasonable, particularly if your goal involves data analysis or machine learning. You can become proficient in C++ later if a course, job, or competitive programming requires it. The most important thing is to understand the underlying concepts well enough to translate them between languages.
The core ideas behind data structures and algorithms are language-independent, so either language can work. Focus first on complexity, problem-solving, and how the structures operate rather than treating the language choice as the main issue.
C++ can be useful for learning because it exposes more of what is happening underneath. Working with pointers, memory allocation, and object lifetimes can make structures such as linked lists feel less abstract. It also gives you access to the STL once you are ready to use standard tools.
Python is usually faster to write and easier to read, which makes it convenient for interviews and for focusing on the algorithm itself. C++ may be preferable for competitive programming when execution speed and memory usage become important, especially on very demanding problems. A practical approach is to learn the fundamentals in the language you are comfortable with, then add C++ if you need its performance or lower-level control.
C++ can help you become more comfortable with implementation details, but Python is still a strong choice for interviews unless you already write C++ confidently.

So C++ may be the better choice for understanding the implementation details, even though the concepts transfer to Python?