algo_016
Problem Statement
Problem Statement
Write an algorithm to traverse or display a circular linked list.
Algorithm
procedure display(cl)
begin
if(cl = NULL)
write("The list is empty.");
else
ptr ← next(cl); //Points to the first node.
do{
write(info(ptr));
ptr ← next(ptr);
} while(ptr ≠ next(cl));
endif
end procedure1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12