+ 1

Wat is the Practical implementation of data structure like stack linked list nd queue ?

data structure

26th Aug 2018, 10:08 AM
Deepak Bhalode
Deepak Bhalode - avatar
1 Answer
+ 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