diff options
author | Toby Vincent <tobyv13@gmail.com> | 2021-04-20 00:48:22 +0000 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2021-04-20 00:48:22 +0000 |
commit | c9cff155e646a2c6ea7bf9af6f0e8d6aefb7d23e (patch) | |
tree | 9abd1b6b45434ccd29d013e9f576d8cccc576e7c /Heap.cs | |
parent | 541ab24f64a3839afb493d8260495eddd4416c37 (diff) |
fixed bug in Right child function
Diffstat (limited to 'Heap.cs')
-rwxr-xr-x | Heap.cs | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -29,7 +29,7 @@ namespace PriorityQueue // get node's right child
protected int Right(int index) =>
- 2 * index + 1;
+ 2 * index + 2;
// swap two indexies
protected virtual void Swap(int that, int other)
@@ -40,7 +40,7 @@ namespace PriorityQueue Array[other] = temp;
}
- protected bool MoreSignificant(T that, T other) =>
+ public bool MoreSignificant(T that, T other) =>
that.CompareTo(other) * (IsMin ? -1 : 1) > 0;
// build local heap
|