## Algorithms | Analysis of Algorithms | Question 19

Consider the following two functions. What are time complexities of the functions? filter_none edit close play_arrow link brightness_4 code int fun1(int n) {     if (n… Read More »

## Algorithms | Analysis of Algorithms | Question 18

Consider the following function int unknown(int n) { int i, j, k = 0; for (i = n/2; i

## Algorithms | Analysis of Algorithms | Question 17

Let s be a sorted array of n integers. Let t(n) denote the time taken for the most efficient algorithm to determined if there are… Read More »

## Algorithms | Analysis of Algorithms | Question 16

Consider the following three claims I (n + k)^m = (n^m), where k and m are constants II 2^(n + 1) = 0(2^n) III 2^(2n… Read More »

## Algorithms | Analysis of Algorithms | Question 15

Consider the following functions Which of the following is true? (GATE CS 2000) (a) h(n) is 0(f(n)) (b) h(n) is 0(g(n)) (c) g(n) is not… Read More »

## Algorithms | Analysis of Algorithms | Question 14

In the following C function, let n >= m. filter_none edit close play_arrow link brightness_4 code int gcd(n,m) {   if (n%m ==0) return m;     n… Read More »

## Algorithms | Analysis of Algorithms | Question 13

Consider the following functions: f(n) = 2^n g(n) = n! h(n) = n^logn Which of the following statements about the asymptotic behavior of f(n), g(n),… Read More »

## Algorithms | Analysis of Algorithms | Question 12

What is the time complexity of Floyd–Warshall algorithm to calculate all pair shortest path in a graph with n vertices? (A) O(n^2logn) (B) Theta(n^2logn) (C)… Read More »

## Algorithms | Analysis of Algorithms | Question 11

What does it mean when we say that an algorithm X is asymptotically more efficient than Y? (A) X will be a better choice for… Read More »

## Algorithms | Analysis of Algorithms | Question 10

The following statement is valid. log(n!) = (n log n). (A) True (B) False Answer: (A) Explanation: Order of growth of and is same for… Read More »

## Algorithms | Analysis of Algorithms | Question 9

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 »

## Algorithms | Analysis of Algorithms | Question 8

What is the time complexity of the below function? filter_none edit close play_arrow link brightness_4 code void fun(int n, int arr[]) {     int i =… Read More »

## Algorithms | Analysis of Algorithms | Question 19

Consider the following program fragment for reversing the digits in a given integer to obtain a new integer. Let n = D1D2…Dm filter_none edit close… Read More »

## Algorithms | Analysis of Algorithms | Question 19

Which of the given options provides the increasing order of asymptotic complexity of functions f1, f2, f3 and f4? f1(n) = 2^n f2(n) = n^(3/2)… Read More »

## Algorithms | Analysis of Algorithms | Question 5

Which of the following is not O(n^2)? (A) (15^10) * n + 12099 (B) n^1.98 (C) n^3 / (sqrt(n)) (D) (2^20) * n Answer: (C)… Read More »