Skip to content

Commit

Permalink
Fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredrik Jonsén committed Oct 28, 2015
1 parent f48ae54 commit 0b0e9f7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lab3/MinPQ.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ class MinPQ

// Percolate up
int hole = ++currentSize;
for( ; hole > 1 && x < array[hole / 2]; hole /= 2)
array[hole] = array[hole / 2];
if (orderOK) {
for( ; hole > 1 && x < array[hole / 2]; hole /= 2)
array[hole] = array[hole / 2];
}
array[hole] = x;
}

Expand Down

0 comments on commit 0b0e9f7

Please sign in to comment.