File tree Expand file tree Collapse file tree 2 files changed +2
-5
lines changed
src/Advanced.Algorithms/DataStructures/Tree Expand file tree Collapse file tree 2 files changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ private RedBlackTreeNode<T> find(T value)
146
146
public int Insert ( T value )
147
147
{
148
148
var node = InsertAndReturnNode ( value ) ;
149
- return node . Position ;
149
+ return Root . Position ( value ) ;
150
150
}
151
151
152
152
/// <summary>
@@ -361,7 +361,7 @@ public int Delete(T value)
361
361
return - 1 ;
362
362
}
363
363
364
- var position = node . Position ;
364
+ var position = Root . Position ( value ) ;
365
365
366
366
delete ( node ) ;
367
367
Original file line number Diff line number Diff line change @@ -10,9 +10,6 @@ internal abstract class BSTNodeBase<T> where T : IComparable
10
10
//Used to fasten kth smallest computation.
11
11
internal int Count { get ; set ; } = 1 ;
12
12
13
- //position of this node in sorted order of containing BST
14
- internal int Position => Left == null ? 0 : Left . Count ;
15
-
16
13
internal virtual BSTNodeBase < T > Parent { get ; set ; }
17
14
18
15
internal virtual BSTNodeBase < T > Left { get ; set ; }
You can’t perform that action at this time.
0 commit comments