Skip to content

Commit 29f4d27

Browse files
author
khanhkhanhlele
committed
Fix typos in src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java
1 parent f0a437d commit 29f4d27

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* give numbers that are bigger, a higher priority. Queues in theory have no
1010
* fixed size but when using an array implementation it does.
1111
* <p>
12-
* Additional contibutions made by: PuneetTri(https://github.com/PuneetTri)
12+
* Additional contributions made by: PuneetTri(https://github.com/PuneetTri)
1313
*/
1414
class PriorityQueue {
1515

@@ -32,8 +32,8 @@ class PriorityQueue {
3232

3333
PriorityQueue() {
3434
/* If capacity is not defined, default size of 11 would be used
35-
* capacity=max+1 because we cant access 0th element of PQ, and to
36-
* accomodate (max)th elements we need capacity to be max+1.
35+
* capacity=max+1 because we can't access 0th element of PQ, and to
36+
* accommodate (max)th elements we need capacity to be max+1.
3737
* Parent is at position k, child at position (k*2,k*2+1), if we
3838
* use position 0 in our queue, its child would be at:
3939
* (0*2, 0*2+1) -> (0,0). This is why we start at position 1
@@ -127,7 +127,7 @@ public int remove() {
127127
if (isEmpty()) {
128128
throw new RuntimeException("Queue is Empty");
129129
} else {
130-
int max = queueArray[1]; // By defintion of our max-heap, value at queueArray[1] pos is
130+
int max = queueArray[1]; // By definition of our max-heap, value at queueArray[1] pos is
131131
// the greatest
132132

133133
// Swap max and last element

0 commit comments

Comments
 (0)