Extracting Sorted Storage from BinaryHeap

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Mar 29 13:05:21 PDT 2015


What's the most efficient way to extract a the storage from a 
BinaryHeap and then sort it?

Is there a better way other than

     binaryHeap.release.sort

than makes use of the heap property? For example

     while (!binaryHeap.empty)
     {
         sortedStorage ~= binaryHeap.front;
         binaryHeap.popFront;
     }

?


More information about the Digitalmars-d-learn mailing list