Question

Given the following set of data: 17, 12, 1, 4, 6, 9, 7, 2 Provide a...

Given the following set of data: 17, 12, 1, 4, 6, 9, 7, 2

Provide a heap that stores the data as a tree. Show how the heap sort algorithm works by providing the heap content/structure with each new number considered.

Display the contents with a heap diagram tree.

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

Initial heap

remove min(1)

remove min (2)

remove min (4)

remove min (6)

remove min (7)

remove min (9)

remove min (12)

remove min (17)

so, sorted list is [1, 2, 4, 6, 7, 9, 12, 17]

Add a comment
Know the answer?
Add Answer to:
Given the following set of data: 17, 12, 1, 4, 6, 9, 7, 2 Provide a...
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
  • 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...

  • 1. Given a set of numbers: A = {1, 3, 5, 2, 8, 7, 9, 4...

    1. Given a set of numbers: A = {1, 3, 5, 2, 8, 7, 9, 4 }. Add each digit of your N-Number (e.g. N0 0 3 2 2 0 1 8) to each element of A separately to get your own final array B. ( e.g. B={1,3,8,4,10,7,10,12} = {B1,B2,B3,B4,B5,B6,B7,B8}. ) a) Your set B = ? b) Use merge-sort to sort the array B. Show each step. c) How many “comparisons” for each algorithm above? 2. Use binary-search for...

  • You are given an input array of integers: [8, 3, 7, 1, 2, 10, 5]. (a)...

    You are given an input array of integers: [8, 3, 7, 1, 2, 10, 5]. (a) Build a min-heap for the input data. Draw a figure just to show the min-heap. (b) Using the min-heap built above, sort the input data in non-descending order using the heap sort algorithm.

  • Given the following data set: 1 5 7 7 9 6 5 4 7. What is...

    Given the following data set: 1 5 7 7 9 6 5 4 7. What is the mode for this data set? Tables Кеу nswer 10 Points 07 06 5 4

  • Data structures Exercises: For the following binary tree (Index-Value): 0 1 2 3 4 5 6...

    Data structures Exercises: For the following binary tree (Index-Value): 0 1 2 3 4 5 6 7 8 9 A C E G B P D X F H Give the pre-order traversal. Give the post-order traversal. Give the in-order traversal. Determine the height of the tree. Using these values: 8 6 4 3 5 9 2 1 6 Build a binary search tree. Build an AVL Tree. Build a 2-3 Tree. Build a min-heap. Build a max-heap. Apply a...

  • Given the following data set X3 4 5 7 8 7 4 6 7 12 14...

    Given the following data set X3 4 5 7 8 7 4 6 7 12 14 a) Draw a Scaker diagram b) Find the coefficient of of determination and Correlation c R² and coefficient c Determine If it is if linear the relation determine is the linear or nonlineare linear regression line d) If line in the and (a) relation sketch above. is linear on the determine the regression same Cordinate System

  • Question 10: Given an array of data: array1 10 5 15 2 7 21 Write the...

    Question 10: Given an array of data: array1 10 5 15 2 7 21 Write the code for the selection sort to sort the data and draw a table showing how the data is sorted using selection sort. Write the code for Binary search algorithm to find the value 15 from the sorted array. Draw the tree diagram showing the binary search of the list.

  • Consider the following data set of skid distance in feet): 12, 17, 8, 9, 11, 5,...

    Consider the following data set of skid distance in feet): 12, 17, 8, 9, 11, 5, 22, 17, 11, 16, 17, 15, 20 sa continuation of number 7. Use your work from above. Suppose that the skid distances In what interval would you expect to find 68% of the skid data? 518, 11, 11, 12, 15, 17, 17,17 18,19,20,22 17 a. Sample size: 13 c. Range: b. Mode: d. Mean: 14.8 e. Median: 17 Drmally distributed with a standard deviation...

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