Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1. public void Insert(T value) {
  2.  
  3.                 //while (true)
  4.                 //{
  5.                     if (_Value.CompareTo(value) > 0)
  6.                     {
  7.                        
  8.                         if (LeftChild == null)
  9.                         {
  10.                             LeftChild = new BinarySearchTreeNode<T>(value);
  11.                             LeftChild.Parent = this;
  12.                         }
  13.                         else  LeftChild.Insert(value);
  14.                     }
  15.                    
  16.                     else if (_Value.CompareTo(value) <= 0)
  17.                     {
  18.                        
  19.                         if (RightChild == null)
  20.                         {
  21.                             RightChild = new BinarySearchTreeNode<T>(value);
  22.                             RightChild.Parent = this;
  23.                         }
  24.                         else RightChild.Insert(value);
  25.                         //this.Value = RightChild.Value;
  26.                        
  27.                 //}  
  28.            }  
  29.       }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement