Start with max = arr[0]
For each remaining element x: if x > max, set max = x
Return max
You do n-1 comparisons. This is O(n).
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
(Loop and compare)
Start with max = arr[0]
For each remaining element x: if x > max, set max = x
Return max
You do n-1 comparisons. This is O(n).