comp.lang.ada
 help / color / mirror / Atom feed
* Search trees
@ 2005-05-12  6:58 VBTricks.de.vu Webmaster
  2005-05-12 16:28 ` Robert A Duff
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: VBTricks.de.vu Webmaster @ 2005-05-12  6:58 UTC (permalink / raw)


Hello,

I'm currently working with search-trees, more exactly different methods 
of listings the items in the search-tree (postfix/postorder, 
infix/inorder, prefix/preorder).

Doing this recursively is no problem, but for an exercise I now need to 
implement these functions iteratively (meaning not recursively). The 
only hint I got was to save which children trees I have not walked 
through. But after four days of thinking I still don't get it.

That's my structure for the nodes of the tree:

    type node;
    type tree is access node;
    type node is record
       value : integer;
       left : tree;
       right : tree;
    end record;

and here a sample for a recursive infix-walkthrough:

procedure Infix(t: tree) is
begin
   if t /= null then
     Infix(t.left);
     Put(t.value);
     Infix(t.right);
   end if;
end;

What is the clue? How do I implement it iteratively? Please help me!


Thanks in advance,

Stefan



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-05-14 14:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-12  6:58 Search trees VBTricks.de.vu Webmaster
2005-05-12 16:28 ` Robert A Duff
2005-05-12 17:51   ` VBTricks.de.vu Webmaster
2005-05-12 17:58     ` Robert A Duff
2005-05-12 18:07       ` VBTricks.de.vu Webmaster
2005-05-12 23:32         ` Georg Bauhaus
2005-05-13  2:02           ` Jeffrey Carter
2005-05-13  2:00 ` Jeffrey Carter
2005-05-14 14:57 ` VBTricks.de.vu Webmaster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox