Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should programmers use STL or write their own code? [closed]

Tags:

c++

stl

I don't know much about C++ data structures but I am wondering do you (programmers) use STL or write your own code? After all STL is designed for doing tasks like searching, replacing and much more through a list of data.

Someone really don't need to learn much about the linked list, binary search and many more because I could use STL. What would you suggest?

like image 929
munish Avatar asked Jul 26 '11 14:07

munish


People also ask

Is STL used in competitive programming?

Yes, STL is allowed in competitive programming and is also advised. Competitive programming is all about speed and STL gives the programmers an opportunity to code with speed and focus more on the logic rather than the code itself.

Can we use STL in coding round?

Yes for sure, unless they want you to implement an algorithm or a data structure in which case you'll have to implement from scratch.

Should I learn STL or DSA first?

Start by learning C++ with DSA ( Data structures and Algorithms) and during that course you will learn about STL ( Standard Template Library) as STL is some in build library that ease your work of Programming .

What are the advantages of using STL?

STL can dramatically change your programming style, allowing your code to be more reusable, solid, and robust. If you take advantage of STL, you can make your life efficient through simplicity. STL is also extensible, letting you add your own containers and algorithms.


1 Answers

You should use STL, because it is well tested and optimized.

That doesn't mean you shouldn't know how to write these data structures yourself. With that ability under your belt, you will be able to choose the best STL data structure for your application.

like image 90
Starkey Avatar answered Sep 23 '22 05:09

Starkey