CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2012
    Posts
    2

    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

  2. #2
    Join Date
    Jan 2012
    Posts
    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)

  3. #3
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,016

    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.

  4. #4
    Join Date
    May 2009
    Posts
    2,413

    Re: question in heap(data structures)

    Quote Originally Posted by ofiri5 View Post
    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
  •  





Click Here to Expand Forum to Full Width

Featured