Calling fire and forget methods.

Davy J <[email protected]> Tue, 26 Feb 2008 13:36:15 +0100
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
Hi all.
  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 DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com