Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
Some are more efficient than others for particular applications. A linked list is a little more versatile than an array, because an array's size must be allocated up front, so there is (at least in the old days) a sequential section of memory for this array. A linked list can hop across multiple parts of memory and be extended, because you just add a pointer to the next data point. Stack is useful when you want an operation that can easily handle Last In First Out (LIFO). If you were working with postfix expressions, a stack is really useful http://interactivepython.org/runestone/static/pythonds/BasicDS/InfixPrefixandPostfixExpressions.html Queue is different, in that it's First In First Out (FIFO). I think this one is quite self explanatory - suppose you have a series of requests made (HTTP requests, lunch orders etc.) they may not be able to be executed immediately, so they'll have to wait, in such a way that they get executed in the order in which they were requested, Queue.E.D (long live the bad puns)
26th Aug 2018, 10:16 AM
Dan Walker
Dan Walker - avatar