Image

Imagelone_wolf225 wrote in Imagecpp

Heaps and k-ary trees

Ok, just to say in advance, I'm using C++ in Microsoft Visual Studio.NET 2003.

The project I have to complete is:

"Generalize the Heap data structure of Section 7.3 from a binary tree to a k-ary tree, for an arbitrary k is greater than or equal to 2. Study efficiences of the resulting data structure for various falues of k, by inserting and removing a large number of randomly generated keys into each data structure"

Ok, I understand what a k-ary tree is. A tree where a node can have up to k children, or something like that. I know that a heap is built to have the minimum value on the top of the heap. The problem is actually building the code to where the user can input some value, and be called by constructor to begin the creation of a k-ary tree.

The code fragments from this book are what they say we seemingly have to generalize (or we could make our own, possibly) : http://cpp.datastructures.net/

http://cpp.datastructures.net/source/ch07/CPP/Interfaces/HeapTree.h-HeapTree.html
http://cpp.datastructures.net/source/ch07/CPP/HeapPriorityQueue.h-HPQ1.html
http://cpp.datastructures.net/source/ch07/CPP/HeapPriorityQueue.h-HPQ2.html

I know this is probably vague thing to answer, but if anyone could help, I'd appreciate it.