In the following table, there are 12 entries in the form nij, where i = 1, 2, 3 and j 1,2,3,4. Each of these entries denotes the largest integer n such that f(n) milliseconds = does not exceed t, where f(n) is the function corresponding to the row of the entry and t is the time corresponding to the column of the entry. For example, for entry n32, we have f(n) = 2^n and t = 1 minute. Hence n32 should be the largest integer n such that 2^n milliseconds is no more than 1 minute.

Q1 (12 points) In the following table, there are 12 entries in the form nij, where i = 1, 2, 3 and j 1,2,3,4. Each of these entries denotes the largest integer n such that f(n) milliseconds = does not exceed t, where f(n) is the function corresponding to the row of the entry and t is the time corresponding to the column of the entry. For example, for entry n32, we have f(n) = 2^n and t = 1 minute. Hence n32 should be the largest integer n such that 2^n milliseconds is no more than 1 minute.

On the answer sheet, enter the values for nij, i = 1, 2, 3, j = 1, 2, 3, 4.



Q1. Solution:

Aim: Each entry denotes the largest integer n such that f(n) milliseconds do not exceed t.


FIRST ROW...........................................

i) Solving n11 : 

Here , f(n) = 100n + 200 And t = 1 second.

so, 100*n + 200 <= t  where n is an integer

100*n <= t - 200

n <= (1000 - 200)/100  : [t = 1second = 1000ms] 

n <= 8

Ans: n11 = 8

ii) Solving n12

Here , f(n) = 100n + 200 And t = 1minute = 60sec = 60000ms

100*n + 200 <= 60000

n <= (60000 - 200)/100

n <= 59800/100

n <= 598

Ans : n12 = 598

iii) Solving n13

Here , f(n) = 100n + 200 And t = 1hr = 60min = 3600sec = 36*105 ms

100*n + 200 <= 36*10^{5}

n <= 35998

Ans : n13 = 35998

iv) Solving n14

Here , f(n) = 100n + 200 And t = 1day = 24hr = 1440min = 86400s = 86400*103ms

100*n + 200 <= 86400000

n <= 863998

Ans : n14 = 863998


SECOND ROW............................................................

v) Solving n21

Here, f(n) = 0.1n^{2} + 100n + 8 and t = 1second = 1000ms

0.1n^{2} + 100n + 8 <= 1000

n^{2} + 1000n - 9920 <= 0

After solving the above quadratic equation we get :

n <= 9.8234

Ans : n21 = 9

vi) Solving n22

Here, f(n) = 0.1n^{2} + 100n + 8 and  t = 1minute = 60sec = 60000ms

0.1n^{2} + 100n + 8 <= 60000

n^{2} + 1000n -599920 <= 0

After solving the above quadratic equation we get :

n <= 421.91105

Ans : n22 = 421

vii) Solving n23

Here, f(n) = 0.1n^{2} + 100n + 8 and  t = 1hr = 60min = 3600sec = 36*105 ms

0.1n^{2} + 100n + 8 <= 3600000

n^{2} + 1000n - 35999920 <= 0

After solving the above quadratic equation we get :

n <= 5520.790645

Ans : n23 = 5520

viii) Solving n24

Here, f(n) = 0.1n^{2} + 100n + 8 and t = 1day = 24hr = 1440min = 86400s = 86400*103ms

0.1n^{2} + 100n + 8 <= 86400000

n^{2} + 1000n - 863999920 <= 0

After solving the above quadratic equation we get :

n <= 28898.127831547

Ans : n24 = 28898


THIRD ROW...............................................................

ix)Solving n31

Here f(n) = 2^{n} and t = 1second = 1000ms

2^{n} <= 1000

n <= log_{2}1000

n <= 9.966

Ans : n31 = 9

x)Solving n32

Here f(n) = 2^{n} t = 1minute = 60sec = 60000ms

2^{n} <= 60000

n <= log_{2}60000

n <= 15.873

Ans : n32 = 15

xi)Solving n33

Here f(n) = 2^{n} and t = 1hr = 60min = 3600sec = 36*105 ms

2^{n} <= 3600000

n <= log_{2}3600000

n <= 21.78

Ans : n33 = 21

xii) Solving n34

Here f(n) = 2^{n} and t = 1day = 24hr = 1440min = 86400s = 86400*103ms

2^{n} <= 86400000

n <= log_{2}86400000

n <= 26.365

Ans : n34 = 26


The table above is filled as follows:

8598
35998
863998
9421552028898
9152126


IF YOU HAVE ANY DOUBT REGARDING THESE QUESTION YOU CAN ASK IN THE COMMENT BELOW. PLEASE UPVOTE THE ANSWER.

Comments

Popular posts from this blog

Multiply Strings Leetcode 43 question Correct Solution

Longest Palindromic Substring Solution