aboutsummaryrefslogtreecommitdiff
path: root/src/tests/heap.cpp (follow)
AgeCommit message (Collapse)Author
2009-11-18Hey, fixed the problems in heap. It should now work properly no matter what theMike Buland
data or order etc.
2009-11-12I've started my campaign to clean up all of the header files in libbu++ as farMike Buland
as includes go. This required a little bit of reworking as far as archive goes, but I've been planning on changing it aronud for a bit anyway. The final result here is that you may need to add some more includes in your own code, libbu++ doesn't include as many random things you didn't ask for anymore, most of these seem to be bu/hash.h, unistd.h, and time.h. Also, any Archive functions and operators should use ArchiveBase when they can instead of Archive, archivebase.h is a much lighterweight include that will be used everywhere in core that it can be, there are a few classes that actually want a specific archiver to be used, they will use it (such as the nids storage class). So far, except for adding header files, nothing has changed in functionality, and no other code changes should be required, although the above mentioned archive changeover is reccomended.
2009-07-31I switched the Bu::Stream::isEOS function to be named Bu::Stream::isEos, andMike Buland
also made sure the copyright is at the top of all the files, it's been too long. Anyway, this may effect some code, but not much, and it's an easy enough fix.
2008-02-19Oops. I made the Bu::Heap API look like a stack, not a queue, that's beenMike Buland
fixed, and the Bu::ItoHeap is working and tested. Note that when multiple items have the same sort order, they will come out in random order.
2008-02-19I believe this will do the trick. The Bu::Heap class now uses the appropriateMike Buland
allocators for all work, every data type used in a Bu::Heap must support the equals operator and <= or >=, or you need to write your own comparison functor. The heap works as both a min-heap and max-heap, just change out the functor used for camparison, kinda' cool. The print function I'll leave in for a little while, but not in the long run, it just prints a dot graph to stdout. Next up, the Ito version.
2008-02-19Bu::Heap is a real class, it works great, except it doesn't grow right now.Mike Buland
I'm thinking the heap should add one layer to the binary tree each time it grows, which means double+1 each time. The Bu::ItoHeap will be implemented as soon as the rest of Bu::Heap is done. Also, I finally added bu/util.h which is mainly handy template functions like Bu::swap, Bu::min, Bu::max, and Bu::mid. A few more may be added.