Skip to content

Commit

Permalink
perf: improve speed of completeInterval on FilteredMap
Browse files Browse the repository at this point in the history
  • Loading branch information
rbellens committed Feb 21, 2024
1 parent 8541ec7 commit 7e4179a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/src/treeset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,20 @@ class AvlNode<V> {

int get balanceFactor => (right?.height ?? 0) - (left?.height ?? 0);

AvlNode<V> get minimumNode => minimumPath.last;
AvlNode<V> get minimumNode {
if (left == null) return this;
return left!.minimumNode;
}

Iterable<AvlNode<V>> get minimumPath sync* {
yield this;
if (left != null) yield* left!.minimumPath;
}

AvlNode<V> get maximumNode => maximumPath.last;
AvlNode<V> get maximumNode {
if (right == null) return this;
return right!.maximumNode;
}

Iterable<AvlNode<V>> get maximumPath sync* {
yield this;
Expand Down

0 comments on commit 7e4179a

Please sign in to comment.