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.


Login/Register to Answer

Related Questions