An l-ary heap is general case of binary heap. All levels are filled with nodes except for the last level which is filled from left to right. A max l-ary heap is a tree where every parent node is greater than all of its child node This program ia about following...
- Build-heap for max l-ary heap
- Inserting a new element in the max l-ary heap.
- Search for an element x in max l-ary heap.
- Delete a given element and rearrange the tree to maintain the l-ary tree property
Enter the total number of elements you want to insert in the heap in starting: 12
Enter the elements one by one: 1 2 3 5 8 4 5 45 22 78 477 44
Enter the value of 'L' for your L-ary heap: 3
Built Heap : 477 8 78 44 2 4 5 45 22 3 5 1
Press your keyboard button according to following:
1 if you want to insert a new element in the tree.
2 if you want to search a element.
3 if you want to delete a element.
4 if you want to exit.