On the previous post, we have already discussed about the concept of Linked List and some of the example of Linked List itself. Now we are going to continue with our next discussion topic regarding the concept of Stack and Queue. These two concepts has the same concept of storing it's elements of data in an ordered manner however, the way on how operate are completely different from each other. In order to cover the basics, let us jump into the discussion.
STACK

STACK
- The Concept

- The Operations
- push(x)
- pop()
- top()
To see how the operations works, see the picture below for reference:
QUEUE
- The Concept

- The Operations
There are 3 main basic operations in Queue, such as:
- push(x)
- pop()
- front()
To see how the operations works, see the picture below for reference:
That is all the basics about Stack and Queue and how they operate according to their own commands.
- END -
References:
S. Sridhar. 2015. Design and Analysis of Algorithms. Oxford University Press. New Delhi. ISBN: 9780198093695. Chapter 5
Reema Thareja. 2014. Data structures using C. Oxford University Press. New Delhi. ISBN:9780198099307. Chapter 7 & 8
Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, & Clifford Stein. (2009). Introduction to Algorithms. 03. The MIT Press. London. ISBN: 9780262033848. Chapter 10
https://visualgo.net/en/list?slide=4
https://visualgo.net/en/list?slide=5
https://www.geeksforgeeks.org/difference-between-stack-and-queue-data-structures/


Komentar
Posting Komentar