# Tag Archives: Algorithms-Analysis of Algorithms

The following statement is valid. log(n!) = (n log n). (A) True (B) False Answer: (A)Explanation: Order of growth of \\log n! and n\\log n is… Read More
In a competition, four different functions are observed. All the functions use a single for loop and within the for loop, same set of statements… Read More
What is the time complexity of the below function?  C void fun(int n, int arr[]) {     int i = 0, j = 0;     for (;… Read More
Consider the following program fragment for reversing the digits in a given integer to obtain a new integer. Let n = D1D2…Dm int n, rev; … Read More
Which of the given options provides the increasing order of asymptotic complexity of functions f1, f2, f3, and f4? f1(n) = 2n f2(n) = n(3/2)… Read More
Which of the following is not O(n2)? (A) (1510) * n + 12099 (B) n1.98 (C) n3/(sqrt(n)) (D) (220) * n Answer: (C)Explanation: The order… Read More
Let w(n) and A(n) denote respectively, the worst case and average case running time of an algorithm executed on an input of size n. which… Read More
The recurrence relation capturing the optimal time of the Tower of Hanoi problem with n discs is. (GATE CS 2012) (A) T(n) = 2T(n –… Read More
What is the time complexity of fun()?  C int fun(int n) {     int count = 0;     for (int i = 0; i < n; i++)… Read More
What is time complexity of fun()?  C int fun(int n) {     int count = 0;     for (int i = n; i > 0; i /=… Read More