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 smaller.) For binary heaps there is a more efficient build implementation that puts all n elements in a binary tree and performs heapify/siftDown on the first half of the elements in reverse order. Just wondering: does something similarly clever exist for binomial heaps?
Binomial heap: more efficient way for initial build than successive inserts?
1.1k Views Asked by fschulze At
2
There are 2 best solutions below
Related Questions in ALGORITHM
- Two different numbers in an array which their sum equals to a given value
- Given two arrays of positive numbers, re-arrange them to form a resulting array, resulting array contains the elements in the same given sequence
- Time complexity of the algorithm?
- Find a MST in O(V+E) Time in a Graph
- Why k and l for LSH used for approximate nearest neighbours?
- How to count the number of ways of choosing of k equal substrings from a List L(the list of All Substrings)
- Issues with reversing the linkedlist
- Finding first non-repeating number in integer array
- Finding average of an array
- How to check for duplicates with less time in a list over 9000 elements by python
- How to pick a number based on probability?
- Insertion Sort help in javascript -- Khan Academy
- Developing a Checkers (Draughts) engine, how to begin?
- Can Bellman-Ford algorithm be used to find shorthest path on a graph with only positive edges?
- What is the function for the KMP Failure Algorithm?
Related Questions in HEAP
- Why would one use a heap over a self balancing binary search tree?
- Data structure to efficiently merge up to n elements of multiset
- How does the following comparator even works while building up the min heap?
- Would building a max heap from an Unsorted array would follow Binary Tree properties?
- std::push_heap and std::pop_heap with MoveConstructible objects
- How to use queue.PriorityQueue as maxheap
- keep keys of different heaps updated when storing links to the same objects
- Finding the running median
- Are the equations of right and left children of heap accurate?
- Formation of Binary Heaps using Arrays Shortcut
- formula for index of a children of a node in a d-ary heap
- K nearest neighbour in a 2d plane
- Kth smallest element greater than or equal to x in a min heap
- implementing data structure
- delMax() api - Priority Queue
Related Questions in BINOMIAL-HEAP
- Data structure with fast insertion
- implement decreasing key in binomial heap
- Can skew binomial heaps support efficient merge?
- Why can't we sort N numbers in comparison sorting algorithm faster than O(n log n) time?
- recursion and traversing a binomial tree
- Number of nodes at depth d in binomial tree
- Printing the contents of a binomial heap in ascending/descending order
- binary heap vs binomial heap vs fibonacci heap, regarding performance for a priority queue
- If binomial heaps are represented as collections of trees, why does this implementation just have one tree?
- What's the most efficient way to convert a binomial tree into a sorted array of keys?
- Correct functional implementation on Binomial Heap
- Binomial heap: more efficient way for initial build than successive inserts?
- Implementing binomial heap
- How do I insert values into this binomial heap?
- Can binomial heap be used to find connected components in a graph?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Actually, inserting all n values into the heap will only take time O(n). Although the worst-case runtime of a binomial heap insert is O(log n), on average it's lower than that.
Here's one way of seeing this using an amortized analysis. Place one credit on each tree in the binomial heap. Whenever you do an insertion, if it involves merging together k different trees, the actual runtime is Θ(1 + k). We'll also spend k credits in the course of doing this, one per tree merged, so the amortized cost is O(1). Therefore any series of n insertions into an empty binomial heap, assuming there are no intervening deletions, will take time O(n). This works even if you don't know the number of elements n in advance, unlike binary heaps.
Alternatively, you could use lazy binomial heaps, where insertions take worst-case time O(1) and deletions are amortized O(log n). In that case, a series of n insertions will take O(n) time as well.
Hope this helps!