diff --git a/C#/Datastructures/BinarySearchTree/Tree.cs b/C#/Datastructures/BinarySearchTree/Tree.cs index 8fadc48..e97ac61 100644 --- a/C#/Datastructures/BinarySearchTree/Tree.cs +++ b/C#/Datastructures/BinarySearchTree/Tree.cs @@ -48,8 +48,13 @@ namespace C_.Datastructures.BinarySearchTree } + public bool Find(T value){ + var x = Descend(value, Root); + return true; + } + private TreeNode? Descend(T value, TreeNode? current) - {//Keep trying to determine whether to go left or right until null node is found + {//Keep trying to determine whether to go left or right until null node is found that can be appended to if (current == default) return default; diff --git a/C#/Program.cs b/C#/Program.cs index 1aa0b1d..d4b046f 100644 --- a/C#/Program.cs +++ b/C#/Program.cs @@ -111,6 +111,8 @@ tree.Add(1); tree.Add(4); tree.Add(7); +tree.Find(2); + Console.ReadLine();