binomial-heap

What is the difference between binary heaps and binomial heaps?

我的梦境 提交于 2019-12-17 23:30:08
问题 I need to know the main difference between binary and binomial heaps regardless of the their structure difference that binary heaps can have only two child (tree representation) and binomial heaps can have any number of children. I am actually just wondering that what so special in organizing the binomial tree structure in such a way that the first child have on one node second have two third have four and so on? What if, if we use some normal tree for heaps without restriction of two child

implement decreasing key in binomial heap

怎甘沉沦 提交于 2019-12-11 09:49:47
问题 in the binomial heap structure, we know only the pointer that points to the min node, but how can I decrease the key of arbitrary node? in this case, first of all, I should find this node and then perform swapping with O(lgN) time. I search online and many points out how to decrease node but does not mention how to access this node to be decreased. Edit: I should use pointers that point to each node of the heap. 回答1: Maybe I'm missing something here, but if you have the key to your 'arbitrary

Correct functional implementation on Binomial Heap

牧云@^-^@ 提交于 2019-12-11 02:17:07
问题 I am reading Binomial Heap in Purely Functional Data Structures. The implementation of insTree function confused me quite much. Here are the set of codes datatype Tree = Node of int * Elem.T * Tree list fun link (t1 as Node (r, x1, c1), t2 as Node (_, x2, c2)) = if Elem.leq (x1, x2) then Node (r+1, x1, t2::c1) else Node (r+1, x2, t1::c2) fun rank (Node (r, x, c)) = r fun insTree (t, []) = [t] | insTree (t, ts as t' :: ts') = if rank t < rank t' then t::ts else insTree (link (t, t'), ts') My

What is the difference between binary heaps and binomial heaps?

纵然是瞬间 提交于 2019-11-28 19:35:09
I need to know the main difference between binary and binomial heaps regardless of the their structure difference that binary heaps can have only two child (tree representation) and binomial heaps can have any number of children. I am actually just wondering that what so special in organizing the binomial tree structure in such a way that the first child have on one node second have two third have four and so on? What if, if we use some normal tree for heaps without restriction of two child and then apply the union procedure and just make one heap the left child of the other heaps? The key