English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

1 answers

INSERTION:

Step-1: If "rear" of the queue is pointing to the last position then go to step-2 or else step-3

Step-2: make the "rear" value as 0

Step-3: increment the "rear" value by one

Step-4:
a. if the "front" points where "rear" is pointing and the queue
holds a not NULL value for it, then its a "queue overflow"
state, so quit; else go to step-b

b. insert the new value for the queue position pointed by the
"rear"


DELETION:

Step-1: If the queue is empty then say "empty queue" and quit; else continue

Step-2: Delete the "front" element

Step-3: If the "front" is pointing to the last position of the queue then step-4 else step-5

Step-4: Make the "front" point to the first position in the queue and quit

Step-5: Increment the "front" position by one


For diagrams and C implementations, see the sources

2006-10-28 01:40:58 · answer #1 · answered by Utkarsh 6 · 0 0

fedest.com, questions and answers