Skip to content

Commit 66cd21c

Browse files
committed
fix bug in casting for bsts
1 parent 86ec237 commit 66cd21c

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/Advanced.Algorithms/DataStructures/Tree/AvlTree.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ private AVLTreeNode<T> find(T value)
419419
return nodeLookUp[value] as AVLTreeNode<T>;
420420
}
421421

422-
return Root.Find<T>(value) as AVLTreeNode<T>;
422+
return Root.Find(value).Item1 as AVLTreeNode<T>;
423423
}
424424

425425
//find the node with the given identifier among descendants of parent and parent

src/Advanced.Algorithms/DataStructures/Tree/BST.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ private BSTNode<T> find(BSTNode<T> parent, T value)
395395
//O(log(n)) worst O(n) for unbalanced tree
396396
private BSTNodeBase<T> find(T value)
397397
{
398-
return Root.Find<T>(value) as BSTNodeBase<T>;
398+
return Root.Find<T>(value).Item1 as BSTNodeBase<T>;
399399
}
400400

401401
/// <summary>

src/Advanced.Algorithms/DataStructures/Tree/SplayTree.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ private SplayTreeNode<T> leftRotate(SplayTreeNode<T> currentRoot)
494494
//O(log(n)) worst O(n) for unbalanced tree
495495
private BSTNodeBase<T> find(T value)
496496
{
497-
return Root.Find<T>(value) as BSTNodeBase<T>;
497+
return Root.Find<T>(value).Item1 as BSTNodeBase<T>;
498498
}
499499

500500
/// <summary>

src/Advanced.Algorithms/DataStructures/Tree/TreapTree.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ private TreapTreeNode<T> leftRotate(TreapTreeNode<T> currentRoot)
489489
//O(log(n)) worst O(n) for unbalanced tree
490490
private BSTNodeBase<T> find(T value)
491491
{
492-
return Root.Find<T>(value) as BSTNodeBase<T>;
492+
return Root.Find<T>(value).Item1 as BSTNodeBase<T>;
493493
}
494494

495495
/// <summary>

0 commit comments

Comments
 (0)