Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 527 Bytes

File metadata and controls

21 lines (15 loc) · 527 Bytes

Pseudocode: Find Largest Number

define procedure find_largest_number:
  input: a pile of numbers, call it PILE

  look at first NUMBER in pile and write it on sticky note, call it MAX_SO_FAR

  foreach NUMBER in PILE, do the following:
    if NUMBER > MAX_SO_FAR, then:
      replace MAX_SO_FAR with NUMBER on sticky note
    end if
  end foreach

  hand back MAX_SO_FAR sticky note
end define procedure

let PILE be [10, 9, -2, 100, 17]
call procedure find_largest_number with inputs: PILE // will give us 100