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:
parent
735bf68e0d
commit
702b251a8a
@ -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)
|
||||||
|
@ -6,7 +6,7 @@ using C_.Datastructures.Generic;
|
|||||||
|
|
||||||
namespace C_.Datastructures.BinarySearchTree
|
namespace C_.Datastructures.BinarySearchTree
|
||||||
{
|
{
|
||||||
internal class TreeNode<T>:DirectedNode<T, TreeNode<T>>
|
internal class TreeNode<T> : DirectedNode<T, TreeNode<T>>
|
||||||
{
|
{
|
||||||
//All properties inherited from base class
|
//All properties inherited from base class
|
||||||
public static TreeNode<T> Create(T? value){
|
public static TreeNode<T> Create(T? value){
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user