Question: This algorithm was written in pseudocode and it searches for the largest value from this data set: 13, 22, 2, 39, 17, 8. A. How
This algorithm was written in pseudocode and it searches for the largest value from this data set: 13, 22, 2, 39, 17, 8.

A. How often do you think the location indicator, which identifies the maximum value, would point to two different positions (or numbers)? And why?
B. How often do you think the location indicator, which identifies the maximum value, would point to five different positions (or numbers)? And why?
1 and n! may be helpful for answering these questions.
1. Set the maximum to the value at position 1 2. Set the location of the maximum to 1 3. Set the index to 2 4. While the index less than or equal to the last position do steps 5-8 5. If the value at the index is greater than the maximum then 6. Set the maximum to the value at the index 7. Set the location of the maximum to the index 8. Increment the index by 1 9. Output the value of the maximum and its location 10. Stop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
