Einzelnen Beitrag anzeigen

Benutzerbild von sk.Silvia
sk.Silvia

Registriert seit: 8. Feb 2006
Ort: Slovenia
90 Beiträge
 
Delphi 7 Personal
 
#8

Re: Create Binary Tree From Preorder input

  Alt 22. Apr 2006, 20:34
i mean, lets have 1,2,3,4,5,6,7,8 as input to this code, its genarets the tree and when we read the tree by 3 types, we get this result

PreOrder :
4;2;1;3;6;5;7;8;
Inorder :
1;2;3;4;5;6;7;8; <-what was our input
Postorder :
1;3;2;5;8;7;6;4;


and now, lets have 1;3;2;5;8;7;6;4; as input

PreOrder :
5;3;1;2;7;8;6;4;
Inorder :
1;3;2;5;8;7;6;4; <-that was our input again
Postorder :
1;2;3;8;4;6;7;5;

and i will to enter a preorder 4;2;1;3;6;5;7;8; (and maybe also an Postorder 1;3;2;5;8;7;6;4; when needed) so i gen an output

PreOrder :
4;2;1;3;6;5;7;8; <-what was our input
Inorder :
1;2;3;4;5;6;7;8;
Postorder :
1;3;2;5;8;7;6;4;

Thanks
  Mit Zitat antworten Zitat