Solved-Homework 5 -Solution

$30.00 $19.00

For the programming problems below, include in your hardcopy submission a printout of your algorithm and of the output. Please follow attached submission instructions. 1. (U&G-required) [30 points] Exercise 6.3-1 (page 159). Exercise 8.2-1 (page 196). (U&G-required) [20 points] Exercise 8.2-3 (page 196). (U&G-required) [30 points] Implement in C/C++ an algorithm that checks if an…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

5/5 – (2 votes)

For the programming problems below, include in your hardcopy submission a printout of your algorithm and of the output. Please follow attached submission instructions.

1. (U&G-required) [30 points]

  1. Exercise 6.3-1 (page 159).

  1. Exercise 8.2-1 (page 196).

  1. (U&G-required) [20 points] Exercise 8.2-3 (page 196).

  1. (U&G-required) [30 points] Implement in C/C++ an algorithm that checks if an array of n elements is a max-heap and determine its running time. The algorithm should print “YES, heap” or “Not a heap”, depending on the outcome. Show how your algorithm works

on the following arrays A = [16 14 10 8 7 9 3 2 4 1] and B = [10 3 9 7 2 11 5 1 6].

  1. (U & G-required) [20 points] Exercise 6.3-2 (page 159).

  1. (G-required) [20 points] Exercise 8.2-4 (page 197).

Extra credit:

6. [20 points]

  1. Find the smallest and the largest number of keys that a heap of height h can have.

  1. Prove that the height of a heap with n nodes is ⌊log% .