Question: Need help with 2 questions. They reference this algorithm written in pseudocode. The algorithm searches for the largest value from this data set: 13, 22,
Need help with 2 questions. They reference this algorithm written in pseudocode. The algorithm searches for the largest value from this data set: 13, 22, 2, 39, 17, 8.

a) What would be the smallest number of positions that location marker could possibly point to during the execution of the algorithm? Describe the special conditions under which this would happen. Approximately how often would you expect this to occur?
b) What would be the largest number of positions that the location marker could possibly point to during the execution of the algorithm? Describe the conditions under which this would happen. Approximately how often would you expect this to occur?
I have deleted the 3rd question since it is not clear. Are these other questions related to probability? Do I use 1 or n! to solve them?
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
