Professional Documents
Culture Documents
Discussion Assignment-03
Discussion Assignment-03
queue data structure and discuss how they are different from the perspective of
how they are used.
Stack:
Stack is a linear data structure in which data may be inserted and removed from
only one end. It follows the principle of LIFO(Last-In-First-Out). LIFO means the
data which enter at last will remove first. I can add an example of lift. In lift, the
last person who enters, he will out of the lift first. Basically we use the function
push to push a data into the stack and use pop function to remove the data. The
accessible element of the stack is called the top element. We use different
variation of the stack implementation. Two basic implementations are Array-
Based Stack and Linked Base (P.117,textbook).
(www.studytonight.co
m)
Queue:
Queue is also a linear data structure in which data may be inserted and removed
from two ends. It follows the principle of FIFO(First-In-First-Out). LIFO means the
data which enter at first will remove first. Queue elements may only be inserted
at the back which is called enqueue and remove from the front which is called
dequeue. For example, in a queue where people line up to pay for their groceries
at their local convenience store, the first person in the queued line will be served
first and will be the first one out, it will work for others in the line. The Queue can
be implemented using Array-Based and Linked (P.125, textbook).
(www.studytonight.com)
References:
Our text book
https://www.studytonight.com/data-structures/queue-data-structure