subject

Develop a CPP program to test is an array conforms heap ordered binary tree. This program read data from cin (console) and gives an error if the last item entered violates the heap condition. Use will enter at most 7 numbers. Example runs and comments (after // ) are below. Your program does not print any comments. An output similar to Exp-3 and Exp-4 is expected. Exp-1:
Enter a number: 65
Enter a number: 56 // this is first item (root,[1]) in the heap three. it does not violate any other item. So, no // this is third [3] number, should be less than or equal to its root ([1])
Enter a number: 45 // this is fourth number, should be less than or equal to its root ([2])
Enter a number: 61 // this is fifth number, should be less than or equal to its root ([2]). It is not, 61 > 55. The 61 violated the heap.
Exp-2:
Enter a number: 100
Enter a number: 95 1/ 95 < 100, OK
Enter a number: 76 // 76 < 100, OK
Enter a number: 58 // 58 < 95, OK
Enter a number: 66 1/ 66 < 95, OK
Enter a number: 58 // 58 < 76, OK
Enter a number: 66 // 66 < 76, OK
Exp-3:
Enter a number: -15
Enter a number: -5
-5 violated the heap.
Exp-4:
Enter a number: 45
Enter a number: 0
Enter a number: 55
55 violated the heap.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:30
What does a cascading style sheet resolve a conflict over rules for an element? a. the rule affecting the most content wins b. the rule affecting the most content loses c. the rule with the most specific selector loses d. the rule with the most specific selector wins
Answers: 2
question
Computers and Technology, 22.06.2019 21:30
How do you take a green screen out of the video while editing?
Answers: 2
question
Computers and Technology, 23.06.2019 08:00
Match the items with their respective descriptions.
Answers: 1
question
Computers and Technology, 23.06.2019 08:00
What is a scenario where records stored in a computer frequently need to be checked
Answers: 2
You know the right answer?
Develop a CPP program to test is an array conforms heap ordered binary tree. This program read data...
Questions
Questions on the website: 13722360