Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Pseudocode please! Sorted Golf Scores Design a program that asks the user to ent

ID: 3916611 • Letter: P

Question

Pseudocode please!
Sorted Golf Scores Design a program that asks the user to enter 10 golf scores. The scores should be stored in an Integer array. Sort the array in ascending order and display its contents.
Pseudocode please!
Sorted Golf Scores Design a program that asks the user to enter 10 golf scores. The scores should be stored in an Integer array. Sort the array in ascending order and display its contents.
Pseudocode please!
Sorted Golf Scores Design a program that asks the user to enter 10 golf scores. The scores should be stored in an Integer array. Sort the array in ascending order and display its contents.

Explanation / Answer

To sort an array of Golf Scores we can use the selection sort algorithm..Please see the pseudocode below..

=======================================================

Start:

1: Declare an array name Golf_Scores of type integer which can hold the 10 array elements.

2: Declare i and j variables of type integer

2: Run a for loop 10 times to accept 10 golf scores.

3: use the selction sort algorithm to sort the golf scores

SELECTION-SORT(A)
4. for j ? 1 to 9    Loop run from j = 1 to J = 9
5. smallest ? j   Make smallest index = j
6.    for i ? j + 1 to 10 This loop run from i = j + 1 to 10
7.    if Golf_Scores[ i ] < Golf_Scores[ smallest ]
8.    smallest ? i   make smallest = ith index
9.    Exchange Golf_Scores[ j ] ? Golf_Scores[ smallest ]

10. Print the sorted golf scores.

END     

========================================================

Kindly Check and Verify Thanks..!!!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote