Oops before dsa or not

I am new into coding and i have this doubt before starting it so
wanna ask this only that before doing dsa
do we need to do oops concept or we can start doing dsa

Funny enough, objects are the runtime implementation of classes, and classes are a data structure. Hence, objects are a subset of DS. There are DS that are not OOP, like struct in C.

Now, you problably are meaning the most usual DS (list, queue, stack, tree, graph, and hash), which usually are implemented on OOP paradigm (THEY ARE NOT OOP PER SE, you can implement them without OOP).

It’s not that you can’t learn those usual DSA without OOP, it’s that you’ll eventally be learning OOP on trying DSA because of how the built in functions and libraries of most of the programming languages are made. For instance, if you are a C++ coder, you’ll end up wondering what’s the difference between vector and array. Both are DS, but vector is a OOP implementation of a list DS, which gives you many more options to work with, and an array is a very simple DS consisting of much memory sticked back another (that is not a list DS).

Now, if you already have some practical knowledge on some OOP implementations of DS, like vector, learning OOP will even be smoothly. So it’s not a bad idea either.

However, although you can try, and even learn DSA and OOP simultaneously, you definitely will need to learn OOP on its own. There are some languages, like Python or C++, on which you can use objects without following the cannonical characteristics of classes and objects, and you could start developing bad coding habits (like recklessly using global variables or mixing functional programming with OOP).

Interestingly enough, Competitive Programming does not follow the best coding habits (which is not its goal either). Due CP is made on a sandbox environment for a single task, you can do many things that should be avoided in real life programing because it would be unsafe. Those two are different goals.

Summarizing.

do we need to do oops concept or we can start doing dsa

No, we don’t need to know OOP to be proficient on DSA in CP. You can try and learn.
But if you are studying Computer Science (or you want to do so), you really shouldn’t miss the OOP concept.

3 Likes