Trying to Incorporate Find function but teek getting warnings that Type T cannot be comfirmed as a reference type. (Could be a struct) Need to find oput why it is affecting BST but not Linked List etc...

This commit is contained in:
Luke Else 2022-04-10 22:27:56 +01:00
parent 735bf68e0d
commit 702b251a8a
3 changed files with 9 additions and 5 deletions

View File

@ -48,9 +48,11 @@ namespace C_.Datastructures.BinarySearchTree
} }
public bool Find(T value){ public bool Find(T? value){
var x = Descend(value, Root); if (Root.Value != default || Root.Value == value)
return true; {
}
} }
private TreeNode<T>? Descend(T value, TreeNode<T>? current) private TreeNode<T>? Descend(T value, TreeNode<T>? current)

View File

@ -1,4 +1,6 @@
namespace C_.Datastructures.Generic using System.Collections.Generic;
namespace C_.Datastructures.Generic
{ {
abstract internal class UndirectedNode<T, NodeType> abstract internal class UndirectedNode<T, NodeType>
{//Generic Node type that every other type inherits from {//Generic Node type that every other type inherits from