diff --git a/src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java b/src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java index a5ca48670..b877a5843 100644 --- a/src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java +++ b/src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java @@ -9,7 +9,7 @@ package com.thealgorithms.datastructures.queues; * give numbers that are bigger, a higher priority. Queues in theory have no * fixed size but when using an array implementation it does. *
- * Additional contibutions made by: PuneetTri(https://github.com/PuneetTri) + * Additional contributions made by: PuneetTri(https://github.com/PuneetTri) */ class PriorityQueue { @@ -32,8 +32,8 @@ class PriorityQueue { PriorityQueue() { /* If capacity is not defined, default size of 11 would be used - * capacity=max+1 because we cant access 0th element of PQ, and to - * accomodate (max)th elements we need capacity to be max+1. + * capacity=max+1 because we can't access 0th element of PQ, and to + * accommodate (max)th elements we need capacity to be max+1. * Parent is at position k, child at position (k*2,k*2+1), if we * use position 0 in our queue, its child would be at: * (0*2, 0*2+1) -> (0,0). This is why we start at position 1 @@ -127,7 +127,7 @@ class PriorityQueue { if (isEmpty()) { throw new RuntimeException("Queue is Empty"); } else { - int max = queueArray[1]; // By defintion of our max-heap, value at queueArray[1] pos is + int max = queueArray[1]; // By definition of our max-heap, value at queueArray[1] pos is // the greatest // Swap max and last element