Загрузка страницы

Binomial Heap Union and Insertion Operations

#techlearners
The procedure of uniting two binomial heaps into one binomial heap
Algorithm: given binomial heaps H1 and H2
Step 1. Merge H1 and H2, i.e. link the roots of H1 and H2 in non-decreasing order.
Step 2. Restoring binomial heap by linking binomial trees of the same degree together: traverse the linked list, keep track of three pointers, Previous, current and next.
Case 1: degrees of current and next are not same, move ahead.
Case 2: If degree of next of next is also same, move ahead.
Case 3: If key of current is smaller than or equal to key of next, make next as a child of current by linking it with current.
Case 4: If key of current is greater than next, then make current as child of next.
Time Complexity of Union Operation O(logn)

The procedure to insert a key in binomial heap
Step 1. create a new binomial heap H1 of one node of value x
Step 2. Unite H1 and H.
Insert Binomial Heap()
1: SET H’ = Create Binomial-Heap()
2: SET Parent[x] = NULL,
Child[x] = NULL and
Sibling[x] = NULL,
Degree[x] = NULL
3: SET Head[H’] = x
4: SET Head[H] = Union Binomial Heap(H, H’)
5: END
Time Complexity of insert operation– O(logn)
TECHLEARNERS BY NEERAJ SAXENA
http://www.techlearners.co.in

Видео Binomial Heap Union and Insertion Operations канала Techlearners By Neeraj Saxena
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
28 ноября 2020 г. 11:25:51
00:16:55
Яндекс.Метрика