Ejemplo n.º 1
0
 public void Exists(int value)
 {
     if (root.Find(value) != null)
     {
         Console.WriteLine("Value {0} appears in the tree", value);
     }
     else
     {
         Console.WriteLine("Value {0} is not in the tree", value);
     }
 }
Ejemplo n.º 2
0
 public Node Find(int data)
 {
     if (root != null)
     {
         return(root.Find(data));
     }
     else
     {
         Console.WriteLine("Node not found!");
         return(null);
     }
 }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            Node testBinaryTree = new Node(0);

            for (int i = 1, count = (int)(Math.Pow(2, 12)) - 1; i < count; i++)
            {
                Node.RandomInsert(ref testBinaryTree, i);
            }
            long totalWeight    = Node.GetTotalWeight(testBinaryTree);
            Node largestSubtree = Node.FindLargestSubtree(testBinaryTree);
            Node foundNode      = Node.Find(testBinaryTree, 16);
        }
Ejemplo n.º 4
0
 public void Find(int val)
 {
     if (value != val)
     {
         if (val < value && CheckNull(childLeftNode, val))
         {
             childLeftNode.Find(val); BTree.path += ",L";
         }
         if (val > value && CheckNull(childRightNode, val))
         {
             childRightNode.Find(val); BTree.path += ",R";
         }
     }
 }
Ejemplo n.º 5
0
        public void Find(int val)
        {
            foundValue = true;

            if (root != null)
            {
                root.Find(val);
            }
            else
            {
                foundValue = false;
                path       = "";
            }
        }
Ejemplo n.º 6
0
 public bool Search(int s)
 {
     return(_root.Find(_root, s));
 }