| | |
a question about heap data structure
![]() |
•
•
Join Date: Sep 2005
Posts: 12
Reputation:
Solved Threads: 0
although this question is basically related to a data structure, still I think that a good progrmmer should be able to answer it. My question is that "is it possible to determine the order in which some ( numbers or characters etc ) are arrived for insertion into a min or max heap ( if we are given that heap )." I think that its answer is yes as there can be so many combinations that we can describe in this regard, but my tutor says that it is not possible, I will be very thank ful for any serious reply.
•
•
•
•
Originally Posted by md_salman
although this question is basically related to a data structure, still I think that a good progrmmer should be able to answer it. My question is that "is it possible to determine the order in which some ( numbers or characters etc ) are arrived for insertion into a min or max heap ( if we are given that heap )." I think that its answer is yes as there can be so many combinations that we can describe in this regard, but my tutor says that it is not possible, I will be very thank ful for any serious reply.
For example, suppose your min-heap has three elements, looking like
C Syntax (Toggle Plain Text)
X / \ Y Z
There are six possible orders of input: X Y Z, X Z Y, Y X Z, Y Z X, Z Y X, Z X Y. Whenever Z comes before Y, the following heap results.
C Syntax (Toggle Plain Text)
X / \ Z Y
Therefore, if you have the heap
C Syntax (Toggle Plain Text)
X / \ Y Z
If the heap has undergone insertion along with removal of the minimum element, then you cannot know anything about the ordering in which two particular elements were inserted.
All my posts may be redistributed under the GNU Free Documentation License.
•
•
Join Date: Sep 2005
Posts: 6
Reputation:
Solved Threads: 0
AOA
here is a link if data structure notes. it will help you to solve your problem \\ Read AVL Tree // data structure.
http://vulms.vu.edu.pk/Links/CS301.htm
ALLAH HAFIZ
here is a link if data structure notes. it will help you to solve your problem \\ Read AVL Tree // data structure.
http://vulms.vu.edu.pk/Links/CS301.htm
ALLAH HAFIZ
![]() |
Similar Threads
- i neeed ur help .. find error in data structure program (C++)
- Data Structure question (C++)
- Data structure + GUI question. (Java)
- Discrete Math or Data structure (Computer Science)
Other Threads in the C Forum
- Previous Thread: Multiline Story String
- Next Thread: Emulator Help!!!!!
| Thread Tools | Search this Thread |
#include * ansi api array arrays asterisks binarysearch calculate centimeter changingto char character convert copyanyfile copyimagefile copypdffile creafecopyofanytypeoffileinc createcopyoffile createprocess() database dynamic execv fflush fgets file floatingpointvalidation fork forloop frequency function getlogicaldrivestrin givemetehcodez grade graphics gtkwinlinux histogram homework i/o inches include infiniteloop input interest intmain() iso keyboard km license linked linkedlist linux list looping loopinsideloop. lowest matrix microsoft mysql oddnumber open opendocumentformat openwebfoundation pdf pointer posix power program programming pyramidusingturboccodes radix read recursion recv recvblocked reversing scanf scheduling segmentationfault send sequential shape single socket socketprogramming stack standard strchr string suggestions test threads turboc unix urboc user variable whythiscodecausesegmentationfault win32api windowsapi






