15-11-2012, 04:00 PM
IMPLEMENTATION OF LINEAR QUEUE USING ARRAYS
IMPLEMENTATION OF LINEAR QUEUE USING ARRAYS.docx (Size: 14.49 KB / Downloads: 38)
Algorithm
STEP 1: Start
STEP 2: [Include all header files]
STEP 3: [Declare the variables]
STEP 4: [If n->1 call the function Enqueue( )]
STEP 5: [If n->2 call the function Dequeue( )]
STEP 6: [If n->3 call the function Peep( )]
STEP 7: [If n->4 call the function Size( )]
STEP 8: [If n->5 call the function View( )]
STEP 9: [else Exit( )]
STEP 10: Stop
Algorithm for Enqueue( )
STEP 1: If[front= =rear]
Initialize front=rear=0
STEP 2: else rear=(rear+1)% qsize
Set queue[rear] =value
[return]
Algorithm for Dequeue( )
STEP 1: If[front = =rear]
1.1: temp=queue[front]
1.2: Initialize front=rear=-1
STEP 2:else
2.1: front=(front+1)% qsize
[return]