Question: Question 4 (CO2, PO1, C2) (a) Define a circular queue data structure. (2 Marks/Markah) (CO2. PO1, C3) (b) Consider a single array Q[1:5). Initially Q[1:5)


Question 4 (CO2, PO1, C2) (a) Define a circular queue data structure. (2 Marks/Markah) (CO2. PO1, C3) (b) Consider a single array Q[1:5). Initially Q[1:5) is empty and all variables front and rear are initialized to zero (O) as shown in Figure 4.1. Given the Circular Queue operation functions are described in Figure 4.2 and a pseudocode in Table 4.1, demonstrate the CIRCULAR QUEUE operation and the output of the statements. Use Table 4.2 in your answer. (8 Marks/Markah) CQ[1:5) [0] [1] [2] [3] [4] [5] rear0 fronto Figure 4.1 ENQ(Q,DATA) : Insert DATA value into Circular Queue Q. DEQIQ,DATA) : Delete a value from Circular Queue Q and-assign it to DATA PRINT(DATA) : Display the value of DATA EMPTYQ(Q) : Is a Boolean function which returns true if Q is empty and false otherwise Figure 4.2 a Table 4.1 Line 1 2 3 4 5 6 7 8 9 10 11 12 Statement DATA: = 1 Do If DATA
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
