Americas
Europe
Q1E
Expert-verifiedList all the steps used by algorithm 1 to find the maximum of the list
1, 8, 12, 9, 11, 2, 14, 5, 10, 4
The maximum of 1, 8, 12, 9, 11, 2, 14, 5, 10, 4 is 14.
Set max = 1
Compare 1 with 8, since 1 < 8 , set max = 8
Compare 8 with 12, since 8 < 12 , set max = 12
Compare 12 with 9, since 12 < 9 , set max = 12
Compare 12 with 11, since 12 < 11 , set max = 12
Compare 12 with 2, since 12 < 2 , set max = 12
Compare 12 with 14, since 12 < 14 , set max = 14
Compare 14 with 5, since 14 < 5 , set max = 14
Compare 14 with 10, since 14 < 10 , set max = 14
Compare 14 with 4, since 14 < 4 , set max = 14
Therefore, the maximum of the given list 1, 8, 12, 9, 11, 2, 14, 5, 10, 4 is 14.
94% of StudySmarter users get better grades.
Sign up for free