Question: Pls do all parts quickly This problem refers to the following algorithm, which takes as input an array A.n of distinct () integers with n
This problem refers to the following algorithm, which takes as input an array A.n of distinct () integers with n 2 2 procedure Med(ai,ap,...,an: a list of real numbers with n 22) 1, u:= a1 2, for j := 2 to n 3, i=1 4. while aj >a 5. 6, m:= aj i:= i + 1 for k := 0 to J-2-1 8, aj-k := aj-k-1 ai := m if j is odd 10. p: u:= ap 12. 13. else 14. 15 (ap + apt1)/2 16. returnv a) Give a brief description of what Med computes. Give the result of the pro- cedure for input (ai, a2, a, a4) (1,2,3, 4)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
