Incomplete - Tested 'Find' function; Doesn't always return on the given item but instead will continue past it if it has any children

This commit is contained in:
Luke Else 2022-04-08 22:35:55 +01:00
parent e9df1cab67
commit 735bf68e0d
2 changed files with 8 additions and 1 deletions

View File

@ -48,8 +48,13 @@ namespace C_.Datastructures.BinarySearchTree
}
public bool Find(T value){
var x = Descend(value, Root);
return true;
}
private TreeNode<T>? Descend(T value, TreeNode<T>? 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;

View File

@ -111,6 +111,8 @@ tree.Add(1);
tree.Add(4);
tree.Add(7);
tree.Find(2);
Console.ReadLine();