...
NIC-NIELIT Scientist-B 2020
October 3, 2023
NIC-NIELIT Scientist-B 2020
October 3, 2023
NIC-NIELIT Scientist-B 2020
October 3, 2023
NIC-NIELIT Scientist-B 2020
October 3, 2023

Nielit Scentist-B [02-12-2018]

Question 1
For the given recurrence equation
T(n)=2T(n-1), if n>0.
=1, otherwise
A
O(nlogn)
B
O(n2)
C
O(2n)
D
O(n)
Question 1 Explanation: 
T(n) = 2T (n – 1) + 1
= 2 [2T(n – 2) + 1] + 1
= 22 T(n – 2) + 3

= 2kT(n – k) + (2k – 1)
= 2n-1T(1) + (2n-1 – 1)
= 2n-1+ 2n-1 – 1
= 2n – 1
≅ O( 2n )
Correct Answer: C
Question 1 Explanation: 
T(n) = 2T (n – 1) + 1
= 2 [2T(n – 2) + 1] + 1
= 22 T(n – 2) + 3

= 2kT(n – k) + (2k – 1)
= 2n-1T(1) + (2n-1 – 1)
= 2n-1+ 2n-1 – 1
= 2n – 1
≅ O( 2n )
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!