Math Fundamentals18 sections · 814 units
Open in Course

Find Maximum - Implementation

(Implementation structure)

function findMax(arr):
    max = arr[0]
    for i from 1 to arr.length - 1:
        if arr[i] > max:
            max = arr[i]
    return max

One loop. n iterations. O(n) time complexity.