Project Title : Binomial Heap

Contents

Introduction to Binomial Heap

A binomial heap is implemented as a set of binomial trees (compare with a binary heap, which has a shape of a single binary tree), which are defined recursively as follows: A Binomial Tree of order 0 has 1 node. A Binomial Tree of order k can be constructed by taking two binomial trees of order k-1 and making one as leftmost child or other. A Binomial Tree of order k has following properties.

Because of its unique structure, a binomial tree of order k can be constructed from two trees of order k−1 trivially by attaching one of them as the leftmost child of the root of the other tree. This feature is central to the merge operation of a binomial heap, which is its major advantage over other conventional heaps.

Deliverables

The project delivers the following functionalities via binomial heap as an api to the user :

Function Syntax Parameters Description Complexity
Create Node create_node(x) init a node with key x returns pointer of newly created Node O(1)
Search Key search_element(H,x) key x to search in heap H returns pointer of key x O(log(n))
Insert insert(H,x) Heap pointer ,pointer to the key to insert insert a key x to heap H O(log(n))
Delete delete_key(H,x) Heap pointer, key to delete deletes the key x from the heap H O(log(n))
Extract Minimum extract_min_node(H) Heap pointer delete and return minimum element in the heap H O(log(n))
Decrease Key decrease_key(H,x,y) Heap pointer, key to be modified, new value to update decreases the key x by value y in Heap H O(log(n))
Merge union_of_heaps(H1,H2) heap pointers to merge merges the 2 heaps H1 and H2 and returns pointer to merged heap O(log(n))

Along with above mentioned functionalities, this projects aims to provide comparative analysis on below major operations with that of AVL tree:-

Also, we have implemented Prim's Algorithm using Binomial heap.The basic method to finding a Minimum Spanning Tree is based on a greedy approach. From a particular vertex, the next vertex is so chosen so that it can be connected to the current tree using the edge of the lowest weight. Repeating this process until all the nodes are included yields the Minimum Spanning Tree. The Prim’s Algorithm is based on the above approach. It uses a Heap for finding the next vertex with the minimum edge weight which can be included in the Minimum spanning tree.

Technologies used

Title Details
Languages C, C++, Python, Markdown
Tools Sublime Text, Git

End User Documentation

Binomial heap functionalities implementation:-

Performance Comparison with AVL tree :-

Time analysis for insertion and deletion in Binomial heap:-

Time analysis for insertion and deletion in AVL tree:-

Graph demonstarting the performance analysis for insert, search and delete operations between Binomial Heap and AVL tree:-

Insert Comparison on Random data
Insert Comparison on Sorted data
Deletion Comparison on Random data
Deletion Comparison on Sorted data
Search Comparison on Random data
Search Comparison on Sorted data

Advantages and Disadvantages of Binomial heap over AVL trees :-

Implementation of Prim’s Algorithm using Binomial heap :-

In computer science, Prim’s algorithm is a greedy algorithm that finds a minimum spanning tree for a weighted undirected graph. This means it finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is minimized. The algorithm operates by building this tree one vertex at a time, from an arbitrary starting vertex, at each step adding the cheapest possible connection from the tree to another vertex.

The algorithm may informally be described as performing the following steps:

To run the Prim’s algorithm using Binomial Heap, follow the steps below

Online resources

Binomial Heaps [Wiki]
Binomial Heaps Overview
cs.toronto.edu
Geeksforgeeks
Fibonacci Heaps [cs.princeton.edu]

Team members

Repository Link

https://shashijangra22.github.io/Advanced-Problem-Solving-Project/