From: "J." <mailing-lists@xs4all.nl>
To: linux-c-programming@vger.kernel.org
Subject: Re: binary tree traversal...
Date: Thu, 27 Jan 2005 21:06:22 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.21.0501272100300.32584-100000@hestia> (raw)
In-Reply-To: <200501262007.19118.eric@cisu.net>
On Wed, 26 Jan 2005, Eric Bambach wrote:
> On Wednesday 26 January 2005 05:01 pm, J. wrote:
> > Wednesday, January 26
> > I guess there is something wrong in my reasoning about this...
>
> Yea, that definatly wont work. I think you're messing up because a recursive
> function can only pass back the top node, or a node that meets a certain
> condition back up the calling stack, without static data, you cant call a
> recursive function and keep going where it left off so you can only return
> one node.
Aha, of course momement here ! ;-)
> Why dont you just pass a function pointer into the recursive function so it
> looks like this:(pseudocode, my function pointer syntax is bad)
Thnkx...
I slept a night over it and decided that it was way more effecient for my
program to keep an shadow array of pointers to each node in the tree.
That way it's easy sorting, iter etc.. And it works without a large mem
increase.
Thnkx again.. for the answer.
J.
next prev parent reply other threads:[~2005-01-27 20:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-26 23:01 binary tree traversal J.
2005-01-27 2:07 ` Eric Bambach
2005-01-27 20:06 ` J. [this message]
2005-01-27 3:19 ` Joel Pareja
2005-01-30 11:49 ` Glynn Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.21.0501272100300.32584-100000@hestia \
--to=mailing-lists@xs4all.nl \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).