3 var A:array [1..max] of integer;
6 procedure bubbledown(n,i:integer);
9 while 2*i <= n do begin
11 if (j<n) and (A[j+1] > A[j]) then inc(j);
12 if A[i] >= A[j] then break;
23 for i:=N div 2 downto 1 do
25 for i:=N downto 2 do begin
35 for i:=1 to N do read(A[i]);
37 for i:=1 to N do write(A[i], ' ');