1. Homepage
  2. Homework
  3. CS 430 – Fall 2022 Introduction to Algorithms - Homework 2 - Max Heap
This question has been solved

CS 430 – Fall 2022 Introduction to Algorithms - Homework 2 - Max Heap

Engage in a Conversation
CS 430Introduction to Algorithms美国AmericaIllinois Institute of TechnologyIITMax Heap

CS 430 – Fall 2022 INTRODUCTION TO ALGORITHMS HOMEWORK #2
DUE SEP. 28 (Wednesday, the end of day)
CourseNana.COM


CourseNana.COM


CourseNana.COM

• Teamwork is NOT allowed.
• Submit the PDF version of the assignment to the Blackboard.
Late submissions will be accepted through Sep. 30 with a credit deduction. • All solutions should be explained.
CourseNana.COM


CourseNana.COM

1. (5 points) A student claims that a preorder traversal of a max-heap will list out its keys in sorted order. Draw a small example of a max-heap that proves him wrong. Do any of the three binary tree traversals (preorder, inorder, postorder) list the keys of a max-heap in any particular order? Why? CourseNana.COM

For tree traversals, please refer to the following example. CourseNana.COM


CourseNana.COM


CourseNana.COM


CourseNana.COM


CourseNana.COM

2. (2 points) What are the minimum and maximum numbers of elements in a heap of height h? Argue for your solution. CourseNana.COM


CourseNana.COM


CourseNana.COM

3. (3 points) The code for MAX-HEAPIFY is quite efficient in terms of constant factors, except possibly for the recursive call in line 10, which might cause some compilers to produce inefficient code. Write an efficient MAX-HEAPIFY that uses an iterative control construct (a loop) instead of recursion. CourseNana.COM

CourseNana.COM

  CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
CS 430代写,Introduction to Algorithms代写,美国代写,America代写,Illinois Institute of Technology代写,IIT代写,Max Heap代写,CS 430代编,Introduction to Algorithms代编,美国代编,America代编,Illinois Institute of Technology代编,IIT代编,Max Heap代编,CS 430代考,Introduction to Algorithms代考,美国代考,America代考,Illinois Institute of Technology代考,IIT代考,Max Heap代考,CS 430help,Introduction to Algorithmshelp,美国help,Americahelp,Illinois Institute of Technologyhelp,IIThelp,Max Heaphelp,CS 430作业代写,Introduction to Algorithms作业代写,美国作业代写,America作业代写,Illinois Institute of Technology作业代写,IIT作业代写,Max Heap作业代写,CS 430编程代写,Introduction to Algorithms编程代写,美国编程代写,America编程代写,Illinois Institute of Technology编程代写,IIT编程代写,Max Heap编程代写,CS 430programming help,Introduction to Algorithmsprogramming help,美国programming help,Americaprogramming help,Illinois Institute of Technologyprogramming help,IITprogramming help,Max Heapprogramming help,CS 430assignment help,Introduction to Algorithmsassignment help,美国assignment help,Americaassignment help,Illinois Institute of Technologyassignment help,IITassignment help,Max Heapassignment help,CS 430solution,Introduction to Algorithmssolution,美国solution,Americasolution,Illinois Institute of Technologysolution,IITsolution,Max Heapsolution,