Questions tagged [binomial-heap]

A binomial heap is a type of priority queue data structure implemented as a forest of binomial trees. Binomial heaps support fast insertion, deletion, and merging.

37 questions
1
vote
1 answer

implement decreasing key in binomial heap

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…
Sean
  • 4,267
  • 10
  • 36
  • 50
1
vote
1 answer

Creating a binomial heap from an array?

When creating a binomial heap, i am aware that the general procedure is to first create a head pointing to nil and slowly insert 1-node heap and unite heaps with same degree based on 4 cases. However, I would like to ask given an array of a size n,…
YHStan
  • 227
  • 3
  • 12
1
vote
2 answers

Number of nodes at depth d in binomial tree

So I have read that the number of nodes in a order k binomial tree at depth d is k choose d. However, I don't see where that result comes from. Anyone have a simple proof/intuition for this?
HashBr0wn
  • 387
  • 1
  • 11
1
vote
2 answers

recursion and traversing a binomial tree

I have the following tree structure: this one shows 3 levels. My actual problem will have 8 to 12 levels. I have the following program that I believe will traverse the tree in the right order. Two children nodes report to a parent node. If we…
DCR
  • 14,737
  • 12
  • 52
  • 115
1
vote
0 answers

Idris not recognizing equivalant types

I'm trying to implement Binomial Heaps in Idris, so I defined a type data Bin = MSEnd | B0 Bin | B1 Bin where MSEnd stands for "Most Significant End" (e.g. B0 (B1 (B1 MSEnd)) represents 6). I also defined a function to add them together. I have…
1
vote
1 answer

DRAWING Binomial Heap

Would anyone know how to draw a binomial max heap for values 1-10? I am currently learning about heaps in my Data Structure course, but after watching multiple videos I still can't get it! And I am not sure if I am doing it right. I understand that…
webdesignnoob
  • 381
  • 1
  • 4
  • 13
1
vote
5 answers

Data structure with fast insertion

I would like to implement data structure which is able to make fast insertion and keeping data sorted, without duplicates, after every insert. I thought about binomial heap, but what I understood about that structure is that it can't tell during…
Michocio
  • 503
  • 3
  • 19
1
vote
1 answer

If binomial heaps are represented as collections of trees, why does this implementation just have one tree?

This Wikipedia article about binomial heaps says that binomial heap is a collection of binomial trees. But this implementation uses only one tree. So I'm confused - is this implementation a binomial heap? If so, how does it get away with just using…
megas
  • 21,401
  • 12
  • 79
  • 130
1
vote
2 answers

Binomial heap: more efficient way for initial build than successive inserts?

Is there a way to initially construct a binomial heap with n given elements with worst case complexity below O(n log n), i.e. using n successive inserts? (I know that the amortized cost of insert is O(1), so the average time complexity for build is…
fschulze
  • 13
  • 3
1
vote
3 answers

Disjoint sets data structures and binomial trees?

Can someone either explain what Disjoint Sets Data Structure is?, or alternatively link me to a YouTube video or article that explains it well. I searched for it a few minutes ago and all I got were some Math lessons that involved an image that…
Austin
  • 3,010
  • 23
  • 62
  • 97
1
vote
1 answer

Recursive Binomial Tree Code, can't do more than 5 steps... why?

function [y]=AmericanPutClassic (St,t) % S0 = 100; K = 100; r = 0.05; sigma = 0.3; T = 2; nsteps = 5; % St dt = T / nsteps; u=exp(sigma*sqrt(dt)); d=1/u; Pu=(exp(r*dt)-d)/(u-d); Pd=1-Pu; if t==T y=max(K-St,0); return elseif t
RoniFinTech
  • 25
  • 1
  • 8
1
vote
1 answer

Implementing binomial heap

My aim is to construct a binomial heap. Here is my code which i have written right now: #include using namespace std; void maxheapify(int a[],int length,int i) { int left=2*i; int right=2*i+1; int largest=i; …
user466534
0
votes
4 answers

Algorithms on merging two heaps

As I know, there exists a binomial heap or a so called mergeable heap, which is used to merge two heaps. My question is, instead of merging these heaps into one heap dynamically, if I copy these two heaps into one big array and then perform a heap…
user466534
0
votes
1 answer

References are not matching

I have a class with the following definition, class BinomialNode { public int key; // The key value public int x_point; // x co-ordinate for drawing public int y_point; // y co-ordinate for drawing public int…
chronodekar
  • 2,616
  • 6
  • 31
  • 36
0
votes
2 answers

Regrading rank in Binomial queue

I am reading about Binomial queue operations here. At bottom of link it is mentioned as Implementation of a Binomial Queue deletemin operation requires ability to find all subtrees of the root. Thus children of each node should be available (say a…
venkysmarty
  • 11,099
  • 25
  • 101
  • 184