Akash R.

asked • 09/12/20

Data and analysis of algorithm

1. illustrate the operation of HEAPSORT on the array A = {15, 113, 12, 125, 17, 117, 120, 18, 14}. Show, visually, the binary tree just after the BUILD-HEAP is called and at the end of each of the HEAPIFY operation.

2. Write a complete algorithm that determines if a given number is a favorite number or not. Use the following definition of a favorite number. The algorithm should take one parameter, the number, and print a message that says if the number is favorite or not. A number N (greater than 0) is said to be favorite if the sum of all its factors equals the number. For example, 6 is a favorite number because 1 + 2 + 3 = 6, and 1, 2 and 3 are favorite of 6. 28 is also a favorite number because 1 + 2 + 4 + 7 + 14 = 28, and the individual numbers are all factors of 28

Patrick B.

Binary tree diagram too
Report

01/15/21

1 Expert Answer

By:

Patrick B. answered • 01/15/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.