public void Run() { int[] nodesFlattened = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; var root = AssortedMethods.CreateTreeFromArray(nodesFlattened); var list = CreateLevelLinkedList(root); PrintResult(list); }
public void Run() { // t2 is a subtree of t1 int[] array1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; int[] array2 = { 2, 4, 5, 8, 9, 10, 11 }; var t1 = AssortedMethods.CreateTreeFromArray(array1); var t2 = AssortedMethods.CreateTreeFromArray(array2); Console.WriteLine((ContainsTree(t1, t2) ? "t2 is a subtree of t1" : "t2 is not a subtree of t1")); // t4 is not a subtree of t3 int[] array3 = { 1, 2, 3 }; var t3 = AssortedMethods.CreateTreeFromArray(array1); var t4 = AssortedMethods.CreateTreeFromArray(array3); Console.WriteLine((ContainsTree(t3, t4)) ? "t4 is a subtree of t3" : "t4 is not a subtree of t3"); }