public static void NodeSelection(BTree <int> tree) { tree.ClearSelected(); PrintSelectionInputFormat(); string input = Console.ReadLine(); try { Queue <int> values = BTreeReader.ReadParentFinderInput(input); BTreeOperations <int> treeOps = new BTreeOperations <int>(); BTreeNode <int> parent = treeOps.ParentFinder(tree, new BTreeNode <int>(values.Dequeue()), new BTreeNode <int>(values.Dequeue())); if (parent != null) { Console.WriteLine("Parent value of {0} has been found.", parent.Value); } else { Console.WriteLine("Parent value was not found."); } } catch (Exception e) { Console.WriteLine("Error reading input for parent finder, recheck input."); Console.WriteLine("Details: {0}", e.Message); } }
public static void NodeSelection(BTree<int> tree) { tree.ClearSelected(); PrintSelectionInputFormat(); string input = Console.ReadLine(); try { Queue<int> values = BTreeReader.ReadParentFinderInput(input); BTreeOperations<int> treeOps = new BTreeOperations<int>(); BTreeNode<int> parent = treeOps.ParentFinder(tree, new BTreeNode<int>(values.Dequeue()), new BTreeNode<int>(values.Dequeue())); if (parent != null) { Console.WriteLine("Parent value of {0} has been found.", parent.Value); } else { Console.WriteLine("Parent value was not found."); } } catch (Exception e) { Console.WriteLine("Error reading input for parent finder, recheck input."); Console.WriteLine("Details: {0}", e.Message); } }