Differences between stacks and linked list

Asked By 30 points N/A Posted on -

HI everyone!

Can anybody will tell me detail description on "THE MAIN DIFFERENCES BETWEEN STACKS AND LINKED LIST?

Which method is more efficient?

When and where we will decide while designing code that which method should be used to run the code more efficiently and we will get the required result?

Best Answer by Charles Water
Best Answer
Best Answer
Answered By 0 points N/A #85963

Differences between stacks and linked list



  • Stack and link list are both are data structures.  
  • Stack is liner type data structure, i.e. they are arranging in liner manner.  In stack whatever is stored first it comes out last. It works in LIFO manner(Last in first out). In stack you can’t add element in between. They are like a stack of coins, i.e. if you want to take the last coin, then all the upper coins have to be removed one by one.
  • Link list is not a liner data structure. Here you can access any element or add any element in between. There is no LIFO of LILO manner (last in last out). In Link list you basically use to pointers , one to store the value of the variable and other to store the address of the next node(link list single element  known as node).As the next link list address is store in the second node, there is no restriction in adding a new link list element in between .  Use:
  • Linked lists provide very fast insertion or deletion of a list member. As each linked list contains a pointer to the next member in the list. Whereas there is disadvantage if you want to perform random accesses it has to go through all the lists.



Answered By 0 points N/A #85964

Differences between stacks and linked list



  • Linked list is simple and the most common data structure. This is used to collect a sequence of objects, implemented as nodes, where each object/node has a link to the next and previous nodes in the sequence. An advantage of this data structure is that elements/objects/nodes can be easily added or removed from the structure without needing to re-organize. 
  • A stack is an abstract data structure.  Due to its three fundamental operation (Push, Pop, and Stack Top), it can only perform limited number of operations. Elements in this data structure can only be removed by following reversely the order on which they are added. 
  • Linked list are also used to implement stack data structure. Efficiency between the two data structure depends on the operation to be performed, but, linked list will be associated to any other abstract data structures like stack since it is a fundamental data structure.


Answered By 590495 points N/A #304063

Differences between stacks and linked list


In programming, a list is a finite or fixed ordered series of data items called “elements.” The list is “ordered” because every element has their individual position or place in the list. The linked list you are saying is one of its two implementations: the array-based list and the linked list.

For the pros, array-based list offers no wasted space for every element while with linked list, it only need space for objects that are actually on the list. For the cons, array-based list should have a pre-determined size and can have wasted space due to empty slots on the list.

While with linked list, it has an overhead for links or an extra pointer that is added to every node. A stack is a LIFO list or (Last-In, First-Out). It is a list-like structure where elements can be removed or inserted from only one end (last-in, first-out). It is easier to implement and more efficient but less flexible than lists.

With stack, elements are pushed into the stack instead of getting inserted.

Related Questions