Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Hewlett-Packard HP9810A programmable desk calculator cost $2960 in 1971 and

ID: 3846643 • Letter: T

Question

The Hewlett-Packard HP9810A programmable desk calculator cost $2960 in 1971 and could perform about 100 instructions per second. Below is a table showing the sizes of the largest problems that it could solve in one minute. For less than this price, you can now buy a computer that is 106 times faster (106 is about 220 times faster). State the worst- case time complexity of each algorithm in the form “O( )” and then estimate the size of the largest problem that the modern computer could solve in the same amount of time (one minute).

Algorithm largest problem size in 1971

(a) Multiplying two n×n matrices by the naive algorithm. n = 6

(b) Heap sort on an array of n integers. n=32

(c) Selection sort on an array of n integers. n=32

(d) Linear search on an array of n integers. n=200

Explanation / Answer

a) Multiplying two nxn matrices will results into O(n^2). So in this case the worst case complexity also lies in O(n^2)

b) In case of the heap sort of the array, the best as well as the worst case time complexity will be O(nlogn)

c) In the case of selection sort of the array with n =32 the worst case time complexity will be O(n^2)

d) Linear search of array with n=200 results into the worst case time complexity O(n)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote