summaryrefslogtreecommitdiffstats
path: root/Heap.cs
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2021-04-20 00:48:22 +0000
committerToby Vincent <tobyv13@gmail.com>2021-04-20 00:48:22 +0000
commitc9cff155e646a2c6ea7bf9af6f0e8d6aefb7d23e (patch)
tree9abd1b6b45434ccd29d013e9f576d8cccc576e7c /Heap.cs
parent541ab24f64a3839afb493d8260495eddd4416c37 (diff)
fixed bug in Right child function
Diffstat (limited to 'Heap.cs')
-rwxr-xr-xHeap.cs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Heap.cs b/Heap.cs
index d937c97..74a3859 100755
--- a/Heap.cs
+++ b/Heap.cs
@@ -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