| | |
a question about heap data structure
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
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 |
Tag cloud for C
#include adobe ansi api array arrays asterisks binarysearch calculate centimeter char command convert copyimagefile cprogramme creafecopyofanytypeoffileinc csyntax directory dynamic fflush file fork forloop framework frequency functions getlasterror givemetehcodez grade graphics gtkgcurlcompiling hacking hardware highest homework inches incrementoperators kernel km lazy linked linkedlist linux linuxsegmentationfault list lists locate logical_drives looping loopinsideloop. match matrix microsoft motherboard multi mysql number opendocumentformat opensource owf pattern pdf performance pointer posix problem probleminc process program programming radix recursion recv repetition research scanf scheduling scripting segmentationfault sequential shape socket socketprograming spoonfeeding stack standard string strings structures student systemcall testautomation threads turboc unix user variable voidmain() wab windows.h






