Re: Binary heaps
- From: "Michal Brzozowski" <rusolis@xxxxxxxxx>
- Date: 31 Aug 2005 02:20:26 -0700
lauren wrote:
> LOG-HEAP UNION is an operation defined as the union of a binary heap of
> size N with a binary heap of size log N. Can a binary heap support
> LOG-HEAP UNION, INSERT and EXTRACT-MIN each in O(log N) time? I'm
> interested in knowing whether this is (i) impossible (ii) non-trivial,
> but (maybe) possible (iii) straightforward
>
> Thanks,
> Lauren
I'm guessing that you mean the first heap is of size N and the other
O(log N) ? If you mean exactly log N, then don't read the rest of this
post :).
If there existed an algorithm that could do LOG-HEAP UNION on two
normal heaps (by normal I mean without any modifications) as you
describe it, then it could join any two heaps in linear time to
their size.
We have 2 heaps, of size N and M.
We know that M=O(log N)
We have an algorithm that joins them in O(log N) time.
Let's say it's O(log N) + O(f(M)), where f(n)=O(n).
So if we forget that M=O(log N) and give this algorithm two
heaps of equal size, it will join them in linear time.
ps.: there might be a mistake in my reasoning, I'm not very
experienced in this subject.
.
- Follow-Ups:
- Re: Binary heaps
- From: Michal Brzozowski
- Re: Binary heaps
- References:
- Binary heaps
- From: lauren
- Binary heaps
- Prev by Date: Binary heaps
- Next by Date: Re: Binary heaps
- Previous by thread: Binary heaps
- Next by thread: Re: Binary heaps
- Index(es):
Relevant Pages
|