similarities between stack and queues
Answers
Answered by
2
Stack: first-in- last -out, or last-in-first-out Queue: first-in-first-out, or last-in- last -out
A stack is a data structure in which the last item inserted is taken out first. That's why they are known as LIFO (last in first out). Inserting an item in the stack is termed as push and taking an item out from the stack Is termed as pop. Some applications of the stack are Polish notation, reversing a string, backtracking, quick sort algorithm etc. The queue is a linear data structure where operations od insertion and deletion are performed at separate ends also known as front and rear. The queue is a FIFO structure that is first in first out. Whenever a new item is added to the queue, the rear pointer is used. and the front pointer is used when an item is deleted from the queue.
A stack is a data structure in which the last item inserted is taken out first. That's why they are known as LIFO (last in first out). Inserting an item in the stack is termed as push and taking an item out from the stack Is termed as pop. Some applications of the stack are Polish notation, reversing a string, backtracking, quick sort algorithm etc. The queue is a linear data structure where operations od insertion and deletion are performed at separate ends also known as front and rear. The queue is a FIFO structure that is first in first out. Whenever a new item is added to the queue, the rear pointer is used. and the front pointer is used when an item is deleted from the queue.
gops5:
sry i ddnt get it but tq u bro
Similar questions