Comparing the values at the top . If the value of heap A [ ] is greater , then counter is incremented
if ( pq1 [ 0 ] > pq2 [ 0 ] ) { c ++ ; pq1 . shift ( ) ; pq2 . shift ( ) ; } else { if ( pq2 . length == 0 ) { break ; } pq2 . shift ( ) ; } } return ( c ) ; }