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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 09:50, laurentsofia09
Assume that you have an sorted array of records. assume that the length of the array (n) is known. give two different methods to search for a specific value in this array. you can use english or pseudo-code for your algorithm. what is the time complexity for each algorithm and why?
Answers: 1
image
Computers and Technology, 22.06.2019 10:10, joanasprinkman2262
3. bob is arguing that if you use output feedback (ofb) mode twice in a row to encrypt a long message, m, using the same key each time, it will be more secure. explain why bob is wrong, no matter what encryption algorithm he is using for block encryption (15 points).
Answers: 3
image
Computers and Technology, 23.06.2019 21:50, Trinhphuongtran
Description: write function lastfirst() that takes one argument—a list of strings of the format "lastname, firstname" —and returns a list consisting of two lists: (a) a list of all the last names (b) a list of all the first names
Answers: 2
image
Computers and Technology, 24.06.2019 02:10, sIatt
Consider the usual algorithm to convert an infix expression to a postfix expression. suppose that you have read 10 input characters during a conversion and that the stack now contains these symbols: (5 points) | | | + | | ( | bottom |_*_| now, suppose that you read and process the 11th symbol of the input. draw the stack for the case where the 11th symbol is
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 in other subjects:

Konu
Mathematics, 23.02.2021 22:30
Konu
Engineering, 23.02.2021 22:30
Konu
Mathematics, 23.02.2021 22:30
Konu
English, 23.02.2021 22:30
Konu
Mathematics, 23.02.2021 22:30