Sample Solution from
Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Chapter 1
Problem 1P
Try another sample solution
Program Plan Intro

To complete the table for given function f(n) and time t .

Expert Solution

Explanation of Solution

Given Information:The time taken by algorithm to solve the problems in f(n) microseconds.

Explanation:

Since 1 microsecond is equal to 106 seconds. Therefore, 1 second is equal to 106 microseconds.

Consider the function f(n)=lg(n) . Now, determine the value of n such that lgn<106

as follows:

lgn<1062lgn<2 106n<2 106

Therefore, the value of n is 2106 for 1 second.

Since 1 hour is equal to 3600 seconds. Therefore, 1 hour is equal to 3.6×109 microseconds.

Again, consider the function f(n)=lg(n) . Now, determine the value of n such that lgn<3.6×109

as follows:

lgn<3.6×1092lgn<23.6× 109n<23.6× 109

Therefore, the value of n is 23.6×109 for 1 hour.

Consider a month is equal to 30 days and a year is equal to 365 days.

Similarly, calculate the other values of t in the different functions f(n) to obtain the correspondinglargest values of n .

Complete the table for different values of n

as follows:

    f(n)1 second1 minute1 hour1 day1 month1 year1 century
    lgn210626×10723.6×10928.64×101022.592×101223.15×101323.16×1015
    n1×10123.6×10151.29×10197.46×10216.72×10249.95×10269.95×1026
    n1×1066×1073.6×1098.64×10102.59×10123.15×10133.16×1015
    nlgn6274628014171333780582755147513718708564047976338933496.86×1013
    n210007745600002939381609968561569256176151
    n3100391153244201373631593146679
    2n19253136414451
    n!9111213151617

Table 1

Not sold yet?Try another sample solution