Find the Maximum Algorithm
currentIndex: 0
maxValue: -1
start with -1 as maximum
5 3 1 2 9 8 7 3 9
0 1 2 3 4 5 6 7 8
Find the Maximum Algorithm
currentIndex: 0
maxValue: -1
5 3 1 2 9 8 7 3 9
0 1 2 3 4 5 6 7 8
Find the Maximum Algorithm
5 3 1 2 9 8 7 3 9
0 1 2 3 4 5 6 7 8
currentIndex: 0
maxValue: -1
found a new maximum!
Find the Maximum Algorithm
currentIndex: 0
maxValue: 5
found a new maximum!
5 3 1 2 9 8 7 3 9
0 1 2 3 4 5 6 7 8
Find the Maximum Algorithm
currentIndex: 1
maxValue: 5
5 3 1 2 9 8 7 3 9
0 1 2 3 4 5 6 7 8
Find the Maximum Algorithm
currentIndex: 2
maxValue: 5
5 3 1 2 9 8 7 3 9
0 1 2 3 4 5 6 7 8
Find the Maximum Algorithm
currentIndex: 3
maxValue: 5
5 3 1 2 9 8 7 3 9
0 1 2 3 4 5 6 7 8
Find the Maximum Algorithm
currentIndex: 4
maxValue: 5
5 3 1 2 9 8 7 3 9
0 1 2 3 4 5 6 7 8
found a new maximum!
Find the Maximum Algorithm
currentIndex: 4
maxValue: 9
5 3 1 2 9 8 7 3 9
0 1 2 3 4 5 6 7 8
found a new maximum!
Find the Maximum Algorithm
currentIndex: 5
maxValue: 9
5 3 1 2 9 8 7 3 9
0 1 2 3 4 5 6 7 8
Find the Maximum Algorithm
currentIndex: 6
maxValue: 9
5 3 1 2 9 8 7 3 9
0 1 2 3 4 5 6 7 8
Find the Maximum Algorithm
currentIndex: 7
maxValue: 9
5 3 1 2 9 8 7 3 9
0 1 2 3 4 5 6 7 8
Find the Maximum Algorithm
currentIndex: 8
maxValue: 9
5 3 1 2 9 8 7 3 9
0 1 2 3 4 5 6 7 8
Find the Maximum Algorithm
currentIndex: 8
maxValue: 9
Finished: output is 9
5 3 1 2 9 8 7 3 9
0 1 2 3 4 5 6 7 8

Find the Maximum Algorithm

  • 1.
    Find the MaximumAlgorithm currentIndex: 0 maxValue: -1 start with -1 as maximum 5 3 1 2 9 8 7 3 9 0 1 2 3 4 5 6 7 8
  • 2.
    Find the MaximumAlgorithm currentIndex: 0 maxValue: -1 5 3 1 2 9 8 7 3 9 0 1 2 3 4 5 6 7 8
  • 3.
    Find the MaximumAlgorithm 5 3 1 2 9 8 7 3 9 0 1 2 3 4 5 6 7 8 currentIndex: 0 maxValue: -1 found a new maximum!
  • 4.
    Find the MaximumAlgorithm currentIndex: 0 maxValue: 5 found a new maximum! 5 3 1 2 9 8 7 3 9 0 1 2 3 4 5 6 7 8
  • 5.
    Find the MaximumAlgorithm currentIndex: 1 maxValue: 5 5 3 1 2 9 8 7 3 9 0 1 2 3 4 5 6 7 8
  • 6.
    Find the MaximumAlgorithm currentIndex: 2 maxValue: 5 5 3 1 2 9 8 7 3 9 0 1 2 3 4 5 6 7 8
  • 7.
    Find the MaximumAlgorithm currentIndex: 3 maxValue: 5 5 3 1 2 9 8 7 3 9 0 1 2 3 4 5 6 7 8
  • 8.
    Find the MaximumAlgorithm currentIndex: 4 maxValue: 5 5 3 1 2 9 8 7 3 9 0 1 2 3 4 5 6 7 8 found a new maximum!
  • 9.
    Find the MaximumAlgorithm currentIndex: 4 maxValue: 9 5 3 1 2 9 8 7 3 9 0 1 2 3 4 5 6 7 8 found a new maximum!
  • 10.
    Find the MaximumAlgorithm currentIndex: 5 maxValue: 9 5 3 1 2 9 8 7 3 9 0 1 2 3 4 5 6 7 8
  • 11.
    Find the MaximumAlgorithm currentIndex: 6 maxValue: 9 5 3 1 2 9 8 7 3 9 0 1 2 3 4 5 6 7 8
  • 12.
    Find the MaximumAlgorithm currentIndex: 7 maxValue: 9 5 3 1 2 9 8 7 3 9 0 1 2 3 4 5 6 7 8
  • 13.
    Find the MaximumAlgorithm currentIndex: 8 maxValue: 9 5 3 1 2 9 8 7 3 9 0 1 2 3 4 5 6 7 8
  • 14.
    Find the MaximumAlgorithm currentIndex: 8 maxValue: 9 Finished: output is 9 5 3 1 2 9 8 7 3 9 0 1 2 3 4 5 6 7 8