Question

# The following pseudocode represents an algorithm to find the median value in a list containing *N* unique

numbers. In this algorithm, we assume that *FindLargest* is a primitive to us, so we can directly call it in the algorithm. Please fill up the blanks to make it work appropriately.

Step 1: Get the values *L*_{1}, *L*_{2}, . . ., *L*_{N} of the numbers in the list

Step 2: If *N* is even then

Let *M* = *N* / 2

Else

Let *M *= (*N* + 1) / 2

Step 3: While (______ ) do steps 4 through 9

Step 4: Use *FindLargest* to find the *location *of the largest number

in the list *L*_{1}*, L*_{2}, . . ., *L*_{N}

Step 5: Exchange *L*_{location} and *L*_{N} as follows

Step 6: *Temp* = ____* *

Step 7: *L*_{N} = _____

Step 8: *L*_{location} = _____

Step 9: Set *N *to _____ * * and effectively shorten the list

Step 10: Print the message 'The median is: '

Step 11: Print the value of *L*_{M}

Step 12: Stop

#### Top Answer

Answer is given... View the full answer