Rank: 242803 based on 0 downloads (last 30 days) and 0 file submitted
photo

Jeremy Kawahara

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by Jeremy
Updated File Comments Rating
20 Oct 2012 Priority Queue (MEX/C++) An efficient priority queue implementation in C++ Author: Andrea Tagliasacchi

Hi, great code! Thanks for sharing! :)

Two small bugs...

1) The current MinHeap will keep adding elements instead of updating them.

The fix is to remove the extra "useBackIdx" condition in "MyHeap.H" in the MinHeap->void push() function.

So change line 316
======
if( useBackIdx || backIdx[index] == -1 ){

to
if( backIdx[index] == -1 ){
======

2) To get this code to work on a 64-bit machine I had to change the addresses from "long" to "unsigned long long". I did this change pretty much anytime something I saw something was cast to a "long".

Hope that helps!
Thanks! -- Jeremy

Contact us