.以下程序的功能是利用堆進行排序請在空白處填上適當語句使程序完整
PROCEDURE sift(VAR r:arr;km:integer);
VAR ijx:integer; t:rec; finished:boolean;
BEGIN
i:=k;___()___; x:=r[i]key;___()___;
t:=r[k];
WHILE (j<=m) AND NOT finished DO
BEGIN IF (j<m) AND ___()___THEN j:=j+;
IF x<=r[j]key THEN finished:=true
ELSE BEGIN___()___;___()___;___()___END;
END;
___()___
END;
PROCEDURE heapsort(VAR r:arr);
VAR i:integer; x:rec;
BEGIN FOR i:=n DIV DOWNTO DO ___()___;
FOR i:=n DOWNTO DO
BEGIN x:=r[];___()___; r[i]:=x;___()___END;
END;【北方交通大學 四 (分)】
[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
From:http://tw.wingwit.com/Article/program/sjjg/201311/22980.html