bst in lev

background image

INORDER

(1,3,4,5,7,10,11,15)

pseudokod:

inorder(drzewo);

begin
if drzewo <> nil then

begin
inorder(drzewo.lewe_subdrzewo);

print(drzewo.root);
inorder(drzewo.prawe_subdrzewo);

end;
end;

LEVELORDER

(7,3,11,1,5,10,15,4)

pseudokod

:

levelorderRek(drzewo, poziom)

begin

if drzewo <> nil then
begin

if poziom = 1, then
print(drzewo.root);

else if poziom > 1 then
levelorderRek(drzewo.lewe_subdrzewo, poziom-1);

levelorderRek(drzewo.prawe_subdrzewo, poziom-1);
endif

end
end


levelorder(drzewo)

begin
for d = 1 to height(drzewo)

levelorderRek(drzewo, d);
end


Wyszukiwarka

Podobne podstrony:
Education in Poland
Participation in international trade
in w4
Metaphor Examples in Literature
Die Baudenkmale in Deutschland
Han, Z H & Odlin, T Studies of Fossilization in Second Language Acquisition
2002 4 JUL Topics in feline surgery
Midi IN OUT
Neural networks in non Euclidean metric spaces
Marsz żałobny, Marsz żałobny Clarinet in Bb 2
C3A4 Transaction in foreign trade Polish ver 2010 10 17
Islam in East Europe
Jacobsson G A Rare Variant of the Name of Smolensk in Old Russian 1964
MCQs in Clinical Pharmacy
Ergonomics In Action

więcej podobnych podstron