algo_043
Problem Statement
Problem Statement
Write an algorithm to dequeue an element from a circular queue using linked representation.
Algorithm
procedure dequeue(cq)
begin
if (cq = NULL) then
write("Deletion not possible");
else if (next(cq) = cq) then
ptr ← cq;
cq ← NULL;
delete(ptr);
else
ptr ← next(cq);
next(cq) ← next(ptr);
delete(ptr);
endif
return(cq);
end procedure1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15