Question: Using the Find Largest algorithm shown in Figure 2 . 1 4 ( which may have to be slightly modified ) and the primitive pseudocode

Using the Find Largest algorithm shown
in Figure 2.14(which may have to be slightly
modified) and the primitive pseudocode
operations listed in Figure 2.9, implement
the selection sort algorithm that we have just
described. Assume that n, the size of the list, and
the n-element list A are input to your algorithm. The
output of your algorithm should be the sorted list.
FIGURE 2.14
Get a value for n, the size of the list
Get values for AT,A9,dots,AIr the list to be searched
Set the value of largest so far to A1
Set the value of location to 1
Set the value of i to 2
While (in) do
If Ai> largest so far then
Set larjest so far to A,
Set location to i
Add 1 to the value of i
End of the loop
Print out the values of largest so far and location
Stop
Algorithm to find the largest value in a list
 Using the Find Largest algorithm shown in Figure 2.14(which may have

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!