//Static helper function to create a random tree of random depth. public static BinaryTree CreateRandomTree(int max = 15) { Random r = new Random(); int numToInsert = r.Next(max * 2); BinaryTree bt = new BinaryTree(r.Next(max)); for (int i = 0; i < numToInsert; i++) bt.Insert(r.Next(max)); return bt; }
//A static helper function which creates a tree guaranteed to have //several sequences adding to the number 6. public static BinaryTree CreateTest1() { BinaryTree bt = new BinaryTree(6); bt.Insert(8); bt.Insert(-5); bt.Insert(-3); bt.Insert(7); bt.Insert(3); bt.Insert(1); bt.Insert(4); bt.Insert(3); return bt; }