Which of the following is true about linked list implementation of stack?
In push operation, if new nodes are inserted at the beginning of linked list, then in pop
operation, nodes must be removed from end.
O
In push operation, if new nodes are inserted at the end, then in pop operation, nodes
must be removed from the beginning.
Both of the above
O None of the above
Answers
Answered by
3
Answer:
push or pull I think this is wrong
Answered by
0
Option d) None of the above is the correct answer.
- Stack works on the LIFO(Last In First Out) structure. The stack is closed from one end, while open from another side, from where the push and pop operations are performed.
- In stack, during the push operation, the new element is inserted from the open end, and during the pop operation, the last inserted element is retrieved from the same open end.
- In the case of linked list implementation of the stack, if the new element is pushed at the beginning, it should be poped from the beginning, and if pushed at the end, it should be poped from the end.
Therefore, none of the options is correct.
#SPJ3
Similar questions