tbsttree=record node: tnode; root: wsk; end; (*procedurka dodaj*) procedure bsttree.add(v:integer); var temp:wsk; begin new(temp); temp^.val:=v; temp^.right:=nil; temp^.left:=nil if root=nil then begin temp^.parent:=root; root:=temp; end else
procedure delete(temp:tnode); begin end;
(*preorder*) procedure preorder(); var poziom:wsk; begin new(temp); temp^.val:=v; poziom:=1; while poziom<>nil do begin if temp^.left<=temp^.right then writeln(v); poziom:=poziom+1;
end;
(*postorder*) procedure postorder();
(*procedurka inorder*) procedure inorder(); inorder(bsttree); begin if bsttree <> nil then begin inorder(bsttree.left); print(bsttree.root); inorder(bsttree.right); end; end;
(*procedurka levelorder*) procedure levelorder(); levelorderRek(bsttree, poziom) begin if bsttree <> nil then begin if poziom = 1, then print(bsttree.root); else if poziom > 1 then levelorderRek(bsttree.left, poziom-1); levelorderRek(bsttree.right, poziom-1); endif end end levelorder(bsttree) begin for d = 1 to height(bsttree) levelorderRek(bsttree, d); end
var
begin root:=nil; current:=root;
{ TODO -oUser -cConsole Main : Insert code here } end.