Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (anonymous):

how to design a procedure for inserting an entry in a cicular queue

OpenStudy (jagatuba):

if queueRear == lastposition rearValue = 0 else rearValue++ if the queueFront == queueRear && position != null print "Queue overflow" system exit else position = newValue

OpenStudy (jagatuba):

Or there abouts.

OpenStudy (anonymous):

THIS WONT LOOP &another is that how to knoow that it full or empty since the queue don't have null pointer.

OpenStudy (anonymous):

you need to have a 2 dimensional array that take 2 objects.. pointer: a pointer to the next object in the array where the last object points to the first one to maintain circularity. value: object that takes the object to be stored in the circular queue. whenever you insert a new value to the end of the queue.. check the pointer.. if it points to the first object then extend the array size by one and change the pointers accordingly. example array[]{{1,a},{2,b},{0,c}}... here you have c pointing to the first object in the array.. now if you append a new object it would be like this: array[]{{1,a},{2,b},{3,c},{0,d}} and go on...

OpenStudy (jagatuba):

I didn't include loop logic in the pseudo code. Good answer fahd.hamad. :)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!