-
January 30th, 2012, 07:38 AM
#1
question in heap(data structures)
hello
i learn data structure in university in israel and i get this question:
Given a Minimum-Heap H with n elements, implemented by a binary Tree (NOT by an array), so that each element in the tree holds only two pointers, one to its left child in the tree and the other to its right child. Thus, elements do not hold pointers to their parent in the tree. Notice that H is represented by a complete binary tree.(the h is O(log n))
i need to:
1)Suggest an O(log n) algorithm for finding the i'th element in the above ordering (i.e., Ai).
2)b) Show how to implement insert algorithm in O(log n)
thank you very much for helping
ofir
-
January 30th, 2012, 07:45 AM
#2
Re: question in heap(data structures)
i forget to add that:
Let {A1, A2, …, An} be the ordering of nodes in H by layers (i.e., for each i < j, either (node) Ai is in a smaller layer than (node) Aj or they are both in the same layer and Ai is to the left of Aj)
-
January 31st, 2012, 02:44 AM
#3
Re: question in heap(data structures)
What progress have you made thus far?
Best Regards,
BioPhysEngr
http://blog.biophysengr.net
--
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
-
January 31st, 2012, 07:17 PM
#4
Re: question in heap(data structures)
Originally Posted by ofiri5
i learn data structure in university in israel
Then you're getting a top-notch education but it's going to be difficult and you'll never survive on your own. I suggest you team up with a class mate asap.
Here's something,
http://en.wikipedia.org/wiki/Binary_heap
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|