15-11-2012, 04:03 PM
ARRAY IMPLEMENTATION OF CIRCULAR QUEUE
ARRAY IMPLEMENTATION OF CIRCULAR QUEUE.docx (Size: 16.2 KB / Downloads: 21)
Algorithm
Step 1: [Include All Header Files Required]
Step 2: [Define the array size as 5 and declare front and rear pointers]
Step 3: Declare the functions isEmpty() , isFull(), enqueue(), size(),dequeue(), peek() and
view()]
Step 4: [Call the functions]
Choice :1 CALL enqueue()
Choice :2 CALL deenqueue()
Choice :3 CALL peek()
Choice :4 CALL size()
Choice :5 CALL view()
Algorithm for isEmpty( )
Step 1: [Check for underflow]
If ( front -1 and rear -1 )
RETURN -1
Step 2: Else RETURN 0
[Finish the process]
Algorithm for isFull( )
Step 1: [Check for overflow]
If (= (rear+1)% qsize front )
RETURN -1
Step 2: Else RETURN 0
[Finish the process]