Example Of Circular Structure4/25/2021
The queue after inserting all the elements into it is as follows.In the above situation, even though we have empty positions in the queue we can not make use of them to insert the new element.
![]() To overcome this problem we use a circular queue data structure. In a circular queue, the new element is always inserted at rear position. The enQueue() function takes one integer value as parameter and inserts that value into the circular queue. We can use the following steps to insert an element into the circular queue. In a circular queue, the element is always deleted from front position. We can use the following steps to delete an element from the circular queue. Then check whether front SIZE, if it is TRUE, then set front 0. Then check whether both front - 1 and rear are equal ( front -1 rear ), if it TRUE, then set both front and rear to -1 ( front rear -1 ).
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |