Question: (b) Consider a single array Q[1:5). Initially Q[1:5) is empty and all variables front and rear are initialized to zero (0) as shown in Figure



(b) Consider a single array Q[1:5). Initially Q[1:5) is empty and all variables front and rear are initialized to zero (0) as shown in Figure 4.1. Given the Linear Queue operation functions are described in Figure 4.2 and a pseudocode in Table 4.1, demonstrate the LINEAR QUEUE operation and the output of the statements. Use Table 4.2 in your answer. (8 Marks/Markah) CQ[1:5] [O] [1] [2] [3] [4] [5] front=0 rear=0 Figure 4.1 a ENQ(Q,DATA) : Insert DATA value into Circular Queue Q. DEQ(Q,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 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
