From: "VBTricks.de.vu Webmaster" <vbtricks@gmx.net>
Subject: Search trees
Date: Thu, 12 May 2005 08:58:55 +0200
Date: 2005-05-12T08:56:55+02:00 [thread overview]
Message-ID: <4282fe37$0$7517$9b4e6d93@newsread2.arcor-online.net> (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
next reply other threads:[~2005-05-12 6:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-12 6:58 VBTricks.de.vu Webmaster [this message]
2005-05-12 16:28 ` Search trees 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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox