Question

In the array A[1..10] that stores the elements [35, 30, 25, 27, 22, 20, 18, 15,...

In the array A[1..10] that stores the elements [35, 30, 25, 27, 22, 20, 18, 15, 10, 5],

  • Construct a min-heap in the array A. Draw the final heap and show its content in the array A. During the construction of heap, show each step of heap construction.
  • Draw the min-heap after removing the Minimum key from 1) and show its content in the array A

  • From the min-heap in 2), sort the array A in the descending order. Draw the heap and show the content of array A after sorting five smallest keys.

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
In the array A[1..10] that stores the elements [35, 30, 25, 27, 22, 20, 18, 15,...
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
  • 5. A three-heap with n elements can be stored in an array A, where A[O] contains...

    5. A three-heap with n elements can be stored in an array A, where A[O] contains the root of the tree. a) Draw the three-heap that results from inserting 5, 2, 8, 3, 6, 4, 9, 7, 1 in that order into an initially empty three-heap. You do not need to show the array representation of the heap. You are only required to show the final tree, although if you draw intermediate trees. b) Assuming that elements are placed in...

  • Sorting Sort the following array using the quick sort algorithm: (4 Marks) a. 12 26 8...

    Sorting Sort the following array using the quick sort algorithm: (4 Marks) a. 12 26 8 9 7 0 4 Pivot selection is defined to be the first element of each sub-list. Show the array before and after each quicksort round (when the array is partitioned after placing the pivot at its correct position). Also, clearly highlight the pivot in each partition b. Consider an unsorted array of integers of size n. Write a Java program to arrange the array...

  • E3. Five-Number Summary and Boxplot 14 10 11 26 30 22 23 10 12 18 ??...

    E3. Five-Number Summary and Boxplot 14 10 11 26 30 22 23 10 12 18 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? Maximum Problem 25 20 12 Information. You are given the 28 23 16 data in the table on the right ?? ?? ?? Requirement. Construct the boxplot ?? ?? ?? Solution Step 1. Sort data Q Step 2. Insert min. and max values Step 3. Calculate values for quartiles Step 4. Insert the quartiles Step...

  • 10 L 1 22 Given the function below, that divides the original array in two arrays...

    10 L 1 22 Given the function below, that divides the original array in two arrays of half size, develop the Java code that combines two sorted arrays or clearly explain how to implement the merge function. (3 points) nt middle values.Length/2; // divide array into two arrays of half size nt left- new int[middle]; or Cint i-e; imiddle; i+) t Leftri] - values[iJ: ntD right- new int[values. length-middle]: or Cint i-a; i<values.length-middle; i++) t rightli] -values [middle+i]; ort(left); //recursively...

  • 1. Consider the following unordered list: 20, 35, 25, 10, 40, 50, 45. Perform heap sort...

    1. Consider the following unordered list: 20, 35, 25, 10, 40, 50, 45. Perform heap sort to sort this list in nondecreasing (ascending) order. a. Perform the bottom-up method to arrange these values into a max heap. Show the heapify operations on each relevant subtree. (10 points) b. Show the tree representation and the array representation of these numbers after every dequeue operation. Remember that dequeue does not delete a number. Dequeue will instead remove that number from the heap...

  • C++ Sorting and Searching 1. Mark the following statements as true or false. a. A sequential...

    C++ Sorting and Searching 1. Mark the following statements as true or false. a. A sequential search of a list assumes that the list elements are sorted in ascending order. b. A binary search of a list assumes that the list is sorted. 2. Consider the following list: 63 45 32 98 46 57 28 100 Using a sequential search, how many comparisons are required to determine whether the following items are in the list or not? (Recall that comparisons...

  • 3. (8 points) Using the implementation of binary search tree operations we discussed in class, draw...

    3. (8 points) Using the implementation of binary search tree operations we discussed in class, draw the trees that result from the following operations: (a) Inserting 142, 400, 205, 127, 100, 320, 160, 141, and 110 into an initially-empty tree (in that order). (b) Deleting 142 from the tree you drew for part (a). 4. (8 points) Draw the unique binary tree that has a preorder traversal of 4, 1, 6, 3, 7, 5, 9, 2, 8 and an inorder...

  • _______________________________________________________________________________________________ java language-trace instructions". (20 points) Show the contents of the array below, once the contents...

    _______________________________________________________________________________________________ java language-trace instructions". (20 points) Show the contents of the array below, once the contents of the array below, once the "pivot" element is placed at its location after each call of the "Partition” algorithm, in the process of running Quick-Sort on said array. Arrange the data in ascending order (Trom Arrange the data in ascending order (from smallest to largest value). Always select the first element of the partition as "pivot" in data cat B. Apply sorting on...

  • 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....

  • Prob. 3. Given the following data 50 40 23 36 19 20 9 a) Is this...

    Prob. 3. Given the following data 50 40 23 36 19 20 9 a) Is this a max heap, draw the tree and check if this is a max heap. b) Illustrate how you would add a new data 46 to the existing maxheap. c) From the answer obtained in part b, illustrate how you would delete the data 40 d) Now illustrate heap sort with the existing data after step c. Give steps, and find runtime. Runtime|Explanation of Algorithm...

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