algo_08
Problem Statement
Problem Statement
Write an algorithm to find max element from the list.
Algorithm
procedure findMax(head)
begin
if(head = NULL)
write("List is empty.");
else
ptr ← head;
max ← info(ptr);
while(ptr ≠ NULL)
if(max < info(ptr))
max ← info(ptr);
endif
ptr ← next(ptr);
end while
return(max);
endif
end procedure1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16