No of visitors who read this post: 4146
Category: C++
Type: Question
Author: Bea56
Your rating: None Average: 1 (2 votes)

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?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

# Comment Id: 19202


  • 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.



# Comment Id: 19395


  • 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.