Page 147 - DCAP407_DATA_STRUCTURE
P. 147

Data Structure



                          In the third figure of figure 8.5, elements 80 and 100 are added to the queue. Now the R value will be 5.
                          Since, the value of SIZE is also 5, R will point to 0.


                                                           Figure 8.5: Circular Queue
















































                                          Program for Implementation of Circular Queue.

                                          #include<stdio.h>
                                          #include<conio.h>
                                          #define SIZE 5
                                          int Q_F(int COUNT)
                                          {
                                               return (COUNT==SIZE)? 1:0;
                                          }

                                          int Q_E(int COUNT)
                                          {
                                               return (COUNT==0)? 1:0;
                                          }
                                          void rear_insert(int item, int Q[], int *R, int *COUNT)
                                          {



                          140                     LOVELY PROFESSIONAL UNIVERSITY
   142   143   144   145   146   147   148   149   150   151   152