Skip to content

Tag Archives: Analysis of Algorithms (Recurrences)

Given an integer N, the task is to find the number of ways to get the sum N by repeatedly throwing a dice. Examples: Input:… Read More
Consider the following recurrence. T(n) = T() + What is the value of recurrence? (A) (B) (B) (B) (A) A (B) B (C) C (D)… Read More
Consider the following recurrence T(n) = 3T(n/5) + lgn * lgn What is the value of T(n)? (A) (B) (c) (D) (A) A (B) B… Read More
The time complexity of the following C function is (assume n > 0 (GATE CS 2004) int recursive (mt n) {    if (n == 1)… Read More
What is the time complexity of the following recursive function: int DoSomething (int n)  {   if (n <= 2)     return 1;   else       return (DoSomething (floor(sqrt(n)))… Read More
The running time of an algorithm is represented by the following recurrence relation: if n <= 3 then T(n) = n else T(n) = T(n/3)… Read More
Consider the following recurrence: Which one of the following is true? (A) T(n) = (loglogn) (B) T(n) = (logn) (C) T(n) = (sqrt(n)) (D) T(n)… Read More
Suppose T(n) = 2T(n/2) + n, T(0) = T(1) = 1 Which one of the following is false. ( GATE CS 2005) a) T(n) =… Read More
What is the worst case time complexity of following implementation of subset sum problem. // Returns true if there is a subset of set[] with… Read More
What is the value of following recurrence. T(n) = 5T(n/5) + , T(1) = 1, T(0) = 0 (A) Theta (n) (B) Theta (n^2) (C)… Read More
What is the value of following recurrence. T(n) = T(n/4) + T(n/2) + cn2 T(1) = c T(0) = 0 Where c is a positive… Read More