Let Q[N] be an array implementation of a linear queue, of size N and
type T. Then ‘front’ is a variable that point to the front element of the queue
and ‘rear’ is a variable that point to the last element of the queue. Initially,
rear=-1 and front=0. Then the algorithm to delete an element from the queue is
as follows:
1.
Start
2.
Check if the Queue is empty or not
if(rear<front)
print “Queue is
Empty” and exit else goto step 3
3.
Store the ‘front’ element in the temporary variable ‘temp’.
temp= Q[front];
4.
Increment the ‘front’
++front;
5.
Return ‘temp’. (item deleted).
6.
Exit
Write an algorithm to sort a linked list using Bubble
ReplyDeletesorting technique.