Question

Say true or false and explain it. A heap is represented using an array. The array...

Say true or false and explain it.

A heap is represented using an array. The array {0 1 3 4 8 2} is a heap.The array {65 43 6 33 40 45} is not a heap.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Heaps are two types: i)max heap ii)min heap

max heap: every parent node have max value compared to all its children

min heap:every parent node have min value compared to all its children.

Add a comment
Know the answer?
Add Answer to:
Say true or false and explain it. A heap is represented using an array. The array...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Java program, In this project, you are going to build a max-heap using array...

    Write a Java program, In this project, you are going to build a max-heap using array representation. In particular, your program should: • Implement two methods of building a max-heap. o Using sequential insertions (its time complexity: ?(?????), by successively applying the regular add method). o Using the optimal method (its time complexity: ?(?), the “smart” way we learned in class). For both methods, your implementations need to keep track of how many swaps (swapping parent and child) are required...

  • Question 3. a. Draw the binary min heap represented by the following array: (5 points) 1...

    Question 3. a. Draw the binary min heap represented by the following array: (5 points) 1 2 4 6 7 Value 4 9 12 29 17 14 16 b. Show the result of calling deleteMin twice on the heap you drew in part (a). Show the heap after each deleteMin, and circle the final heap. (5 points) c. Starting with the heap you ended up with in part (b), insert values 11 & 2 in that order. Draw the heap...

  • 1. Which of the following is a proper array representation a binary min heap?

    1. Which of the following is a proper array representation a binary min heap?2. A heap is implemented using an array. At what index will the right child of node at index i be found? Note, the Oth position of the array is not used.Select one:a. i/2b. 2 i+1c. i-1d. 2 i3. Consider the following array of length 6. Elements from the array are added, in the given order, to a max heap. The heap is initially empty and stored as an array.A={18,5,37,44,27,53}What...

  • Check if an array is a heap in Java. Complete the method isHeapTree Together, these methods...

    Check if an array is a heap in Java. Complete the method isHeapTree Together, these methods are meant to determine if an array of objects corresponds to a heap. The methods are generic, and they should work with an array of any type T that implement Comparable<T>. Implement the second method so that it uses recursion to process the complete tree/subtree whose root is at position i in the array arr. The method should return true if that tree/subtree is...

  • C++ Programming By using Binary heap Develop a CPP program to test is an array conforms...

    C++ Programming By using Binary heap 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 // this is...

  • Problem 4: [2056] Consider the mattan which is represented by the array A. Show the max...

    Problem 4: [2056] Consider the mattan which is represented by the array A. Show the max heap in A after a heap deletion operation. Answer: Array A : 60 50 45 35 10 20 25 40 15 30 Problem 5: [1596] Show the contents of the deauE after each ofthe following operation? a. Dequelnterface String> myDeque new LinkedDeque String 0 b. myDeque.addToFront("Jim) c. myDeque.addToFront(Jess") d. myDeque.addToBack "Jill) e. myDeque.addToBack( "Jane" f String name- myDeque.removeFronto g myDeque.addToBack(name) h myDeque.addToBack(myDeque.getFront) i. myDeque.addToFront(myDeque.removeBackO)...

  • Convert the array a = [10, 26, 52, 76, 13, 8, 3, 33, 60, 42] into a maximum heap using the linear time heap building algorithm. Show the order of all items after each iteration.

    Convert the array a = [10, 26, 52, 76, 13, 8, 3, 33, 60, 42] into a maximum heap using the linear time heap building algorithm. Show the order of all items after each iteration.

  • PROGRAM DESCRIPTION Using the given class definitions for either C++, create a minimum heap that stores...

    PROGRAM DESCRIPTION Using the given class definitions for either C++, create a minimum heap that stores integers and and implements a minimum priority queue. (Your program can be "hard coded" for integers - it does not need to use templates, generics, or polymorphism.) Your data structure must always store its internal data as a heap. Your toString function should return a string with the heap values as a comma separated list, also including the size of the heap as well....

  • This question is about the min-heap. A min-heap with 10 elements is given in the following...

    This question is about the min-heap. A min-heap with 10 elements is given in the following array format. The following three sub-questions all refer to this min-heap i 1 2 3 4 5 6 7 8 9 10 A[i] 11 22 33 44 55 66 77 88 99 100 Show the result after applying heap-decrease-key(A, 6, 12) to the min-heap at the top of this page: i 1 2 3 4 5 6 7 8 9 10 A[i] Show the...

  • Tree & Hash Table & Heap Use the following integer keys 73, 58, 91, 42, 60,...

    Tree & Hash Table & Heap Use the following integer keys 73, 58, 91, 42, 60, 130, 64, 87 to perform the followings: a) Binary Search Tree - Draw a binary search tree - Retrieve the integers keys in post-order - Retrieve the integers keys in pre-order - Draw a binary search tree after node 58 is deleted b) Create a Hash Table using the methods described below. Show the final array after all integer keys are inserted. Assumes that...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT