The running time of an algorithm T(n),where 'n' is the input size, of a recursive algorithm is given as follows.is given by
T(n) =c + T(n - 1), if n > 1
A. | n2 |
B. | n |
C. | n3 |
D. | nn |
Option: B Explanation :
By recursively applying the relation we finally arrive at
T(n-I) = c(n-I) + T (1) = c(n-I)+d
So, order is n
Click on Discuss to view users comments. bhawna said: (5:47pm on Monday 30th September 2013)
don't understand hat the exact solution what is c and d here
sakshi said: (8:34pm on Tuesday 8th August 2017)
don't understand pls explain in details
'> |
A. | F3, F4, FI, F5, F6, F2 |
B. | F2, F6, F5, Fl, F4, F3 |
C. | Fl, F2, F3, F4, F5, F6 |
D. | Ordering is immaterial as all files are accessed with the same frequency |
Option: A Explanation :
Since the access is sequential, greater the distance, greater will be the access time. Since all the files are referenced with equal frequency, overall access time can be reduced by arranging them as in option (a).
Click on Discuss to view users comments. |
A. | 268 units |
B. | 256 units |
C. | 293 units |
D. | 210 units |
Option: A Explanation :
Since each file is referenced with equal frequency and each record in a particular file can be referenced with equal frequency, average access time will be (25 + (50 + 40) + (50 + 80 + 50) + ... )/6 = 268 (approximately).
Click on Discuss to view users comments. rama said: (3:28pm on Wednesday 13th February 2013)
from where did u take these values?
sakshi said: (8:41pm on Tuesday 8th August 2017)
from where u get these values pls explain me
|
A. | max (f (n) ,g (n)) |
B. | min (f (n) ,g (n) ) |
C. | f (n) + g (n) |
D. | f (n) x g (n ) |
Option: A Explanation :
By definition of order, there exists constants c1, ec2, n1, n2 such that
T (n) ≤ c1 x f (n) , for all n ≥ n1.
T (n) ≤ c2 x f (n) , for all n ≥ n2.
N = max (n1, n2) andC = max (c1, c2). So,
T (n) ≤ C x f(n) for all n ≥ N
T (n) ≤ C x g (n) for all n ≥ N
T(n) ≤ C/2 x (f(n)+g(n))
Without loss of generality, let max ( f (n), g (n)) =f(n) .
So, T (n) ≤ C / 2 (f(n) + f (n) ) ≤ C x f(n) .
So, order is f(n) , which is max (f(n), g (n) ) , by our assumption.
Click on Discuss to view users comments. |
A. | A1 |
B. | A2 |
C. | A4 |
D. | A3 |
Option: B Explanation : Click on Discuss to view users comments. Mayank said: (10:47pm on Friday 8th March 2013)
According to me, The correct answer is: B (A2), because it gives the least value while calculating the log(log(n)) for any value of n.please justify me the reason for selecting the answer as C (A4).
|
Syllabus covered in this section is-
This Section covers Data Structures Questions Answers using C language .
Who can benefit -
Various Search Terms used for this section are