.以下程序的功能是利用堆进行排序请在空白处填上适当语句使程序完整
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;【北方交通大学 四 (分)】
[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []