Beispiel #1
0
        private static IntSearchTree BuildBSTFromList(IntSearchTree treeInt, List <int> list)
        {
            if (list.Count == 0)
            {
                return(null);
            }
            List <int> auxList = new List <int>();

            for (int index = 0; index < list.Count; index++)
            {
                if (auxList.Contains(list[index]))
                {
                    continue;
                }
                auxList.Add(list[index]);
                treeInt.Add(list[index]);
            }
            return(treeInt);
        }
Beispiel #2
0
 public static string ToStringPreOrder(IntSearchTree treeInt)
 {
     return(ToStringPreOrder(treeInt.root));
 }
Beispiel #3
0
 public static int Sum(IntSearchTree treeInt)
 {
     return(Sum(treeInt.root));
 }
Beispiel #4
0
 public static bool ExistsST(IntSearchTree treeInt, int value)
 {
     return(ExistsST(treeInt.root, value));
 }
Beispiel #5
0
 public static int Height(IntSearchTree treeInt)
 {
     return(Height(treeInt.root));
 }