Is it ok to use built-in methods when learning DSA?

Hope you´re doing great.
I’m learning DSA and I’m wondering if it’s acceptable to use built-in methods or if it’s better to write everything from scratch. Sometimes I feel bad for using built-in methods because I feel like I’m not learning by doing it that way. What do you think about this?

Hi @brayan0404 - welcome to the forums!

Unless you are about to have an exam or interview where you will be asked to implement an algorithm from scratch, using built-in methods is totally fine.

Often, built-in methods will be faster since they will likely be optimized at a lower level than the code you and I would write.

Also, for 99.99% of all cases, even horribly slow algorithms will be fine for most use cases. Our CPUs are fast, and a n-squared running time algorithm when dealing with even 5000 items will not be noticeable.

Does this help?


Yes, this helps a lot! I appreciate your response. Beyond exams or interviews, don’t you think it would be cool and useful to learn how to create those algorithms from scratch yourself, for the knowledge and skills you could gain? Thank you again for your insight!

Absolutely. Knowing more about the internals of how things work is always a good thing. Having that curiosity to learn about something that may not have an immediate “payoff” is one of those signals that indicates someone really loves what they are doing. Plus, the knowledge you gain from implementing an algorithm may indirectly benefit other problems you may face in the future.

Now, should you prioritize learning how to write your own algorithms over say, something like, learning system design for a variety of application types, that’s debatable :slight_smile:

Thanks @kirupa, appreciate your response!

1 Like