~ Consider the following sort routine: procedure selectsort(var r: array [1 .. n] of integer); var j,
Question:
~ Consider the following sort routine:
procedure selectsort(var r: array [1 .. n] of integer);
var j, k, small: integer;
begin if n > 1 then for k:= 1 to n - 1 do small:= k;
for j:= k + 1 to n do if r[j] < r[small] then small:= j end end;
swap(r[k], r[small])
end end end selectsort;
Determine the function (by means of pre- and postconditions) of this routine using stepwise abstraction.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Question Posted: