Saturday, September 28, 2013

Fun with Heaps!

It's been a while since my undergraduate and I've forgotten how fun my Computer Science degree was.

I'm re-reading Introduction to Algorithms and having quite a lot of fun with it.

The latest chapter I went over was the chapter on heaps. So I decided to implement some of the data structures and algorithms.

Here is my code for creating heaps (both max and min-heaps) and heap sort.

I also created a test file.

Also introduced along with heaps are priority queues as they go really well together. Here are my implementations for a max and min-priority queue.

And of courses tests!

No comments:

Post a Comment