Basics of ds | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Basics of ds

What is difference between data structure and standard template library ? Can we call vector as data structure ? One more question is related to tree and graph. When to choose what among these two ? Any real time example would be more useful to understand.

28th Jan 2020, 9:11 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
5 Answers
+ 3
For example of graph, please expand the comments of that graph lesson, you can find examples of Java, C++, C# and Python. For your first question, Data Structure is the concept, it applies to all programming language. Standard Template Library is the implementation in C++ to speed up production. In later language, many data structure such as Hash Map is built-in (Python's Dictionary, JavaScript's Object). Tree, in Mathematics' Graph Theory, is a kind of Graph. In programming, Tree has many different types, each type has its different usage. You can expand the comment section of each Tree lesson to see some examples.
29th Jan 2020, 4:15 AM
Gordon
Gordon - avatar
+ 2
Thanks Gordon .. this answers my second question. Any other example of graph usage ? I am not able to think about another example for tree on my own. Additionally , my first question still confuses me that what's difference between stl and ds.
29th Jan 2020, 3:31 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 2
I would call a vector a data structure.
30th Jan 2020, 3:57 AM
Sonic
Sonic - avatar
+ 2
If you're modelling the collection of members and their links in a social network, you would use a graph and not a tree.
30th Jan 2020, 3:58 AM
Sonic
Sonic - avatar