algo_008.md (461B)
1 # algo_008 2 3 ### Problem Statement 4 5 > Write an algorithm to find max element from the list. 6 7 ## Algorithm 8 ``` 9 procedure findMax(head) 10 begin 11 if(head = NULL) 12 write("List is empty."); 13 else 14 ptr ← head; 15 max ← info(ptr); 16 while(ptr ≠ NULL) 17 if(max < info(ptr)) 18 max ← info(ptr); 19 endif 20 ptr ← next(ptr); 21 end while 22 return(max); 23 endif 24 end procedure 25 ```