Traverse Queue of type Array by R4R Team

How we traverse the Queue ?
When we think about that how we display or traverse the queue then two idea come in mind that
- traverse from front to rear
or
- traverse from rear to front

Which one is correct ?
'front to rear traverse' is the correct one because we traverse the element which come first in queue

Following is the which are used to display the queue from to rear:

void display()
{
int i;
if (front==-1)
printf("Queue is empty \n");
else
{
printf("Queue is : \n");
for (i =front; i< = rear; i++)
printf("%d ", queue[i]);
}
}




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!