Re: Calling fire and forget methods.
Frans Bouma <[email protected]> Tue, 26 Feb 2008 13:50:47 +0100
| Newsgroups | gmane.comp.windows.devel.dotnet.clr |
|---|---|
| Message-ID | <00d001c87876$3535ee20$9fa1ca60$@nl> |
It seems you didn't implement this as an array? With an array, it's very
simple.
See: http://en.wikipedia.org/wiki/binary_tree
for details.
FB
> I've got a Binary tree implementation that I need a little help with.
> my problem is the recursive lhs.Add(item) and rhs.Add(item) call, is there
> any way I could refactor this to remove the stack dependancy?
>
> the application is written in Net.2.0 , so no fancy linq replys please :)
>
> Cheers
>
> Dave.
>
> the psudeo code for the Add function. (written in gmail's c# editor)
>
> public void Add(T item)
> {
> if (this.item == null)
> {
> this.item = item;
> return;
> }
> if (item < this.item)
> {
> if (lhs == null)
> {
> lhs = new TreeNode<T>();
> }
> lhs.Add(item);
> }
> else
> {
> if (rhs == null)
> {
> rhs = new TreeNode<T>();
> }
> rhs.Add(item);
> }
> }
>
> ===================================
> This list is hosted by DevelopMentorR http://www.develop.com
>
> View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com