summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2021-04-20 00:49:25 +0000
committerToby Vincent <tobyv13@gmail.com>2021-04-20 00:49:25 +0000
commitcbb581eefb3ac38f36810865c264d9b52fbd9657 (patch)
treef5b3cf6ff7117599257b365a11c2f7742b50f4ad
parentc9cff155e646a2c6ea7bf9af6f0e8d6aefb7d23e (diff)
removed unused conditional exception
-rwxr-xr-xPriorityQueue.cs8
1 files changed, 2 insertions, 6 deletions
diff --git a/PriorityQueue.cs b/PriorityQueue.cs
index d7bc86e..e89f81c 100755
--- a/PriorityQueue.cs
+++ b/PriorityQueue.cs
@@ -61,12 +61,12 @@ namespace PriorityQueue
if (HeapSize < 0)
throw new System.OverflowException("Heap Underflow");
- T sig = Peek();
+ T head = Peek();
Swap(0, HeapSize--);
Heapify(0);
- return sig;
+ return head;
}
protected bool LessSignificant(U that, U other) =>
@@ -76,10 +76,6 @@ namespace PriorityQueue
{
int index = Location[id];
- // key < Array[index].Key
- if (LessSignificant(key, Array[index].Key))
- throw new System.ArgumentException($"New key ({key}) is less significant than node {id}'s current key ({Array[index].Key}).");
-
Array[index].Key = key;
while (index > 0 && MoreSignificant(Array[index], Array[Parent(index)]))