Open In App

Data Structures | Stack | Question 3

Like Article
Like
Save
Share
Report

Which of the following is true about linked list implementation of stack?
(A) In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end.
(B) In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the beginning.
(C) Both of the above
(D) None of the above


Answer: (D)

Explanation: To keep the Last In First Out order, a stack can be implemented using linked list in two ways:

a) In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from beginning.

b) In push operation, if new nodes are inserted at the end of linked list, then in pop operation, nodes must be removed from end.


Last Updated : 05 Feb, 2013
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads