#Day22 #100DaysOfCode
Queue is data structure similar to stack. Instead, it follows the FIFO principle where the first element comes first will be served first. In other words, the first inserted element will be removed before anything else.
A mistake I accidentally made was to ignore the rear index and implemented queue as like inserting and deleting elements in 1d array. What I found out was that the front and rear index should really be the main focus of queue. There was no deliberate deletion like in 1d array. i.e: shift all the elements to the left by one position. The queue is visible only when there is front and rear index.
Solved some problems with queues. i.e: right-truncatable prime, displaying messages on screen.
Queue is data structure similar to stack. Instead, it follows the FIFO principle where the first element comes first will be served first. In other words, the first inserted element will be removed before anything else.
A mistake I accidentally made was to ignore the rear index and implemented queue as like inserting and deleting elements in 1d array. What I found out was that the front and rear index should really be the main focus of queue. There was no deliberate deletion like in 1d array. i.e: shift all the elements to the left by one position. The queue is visible only when there is front and rear index.
Solved some problems with queues. i.e: right-truncatable prime, displaying messages on screen.