Skip to content

Tag Archives: Algorithms-Analysis of Algorithms

Given an array arr[], the task is to find the count of array elements whose squares are already present in the array. Examples: Input: arr[]… Read More
What is Algorithm? Algorithm Basics The word Algorithm means “a process or set of rules to be followed in calculations or other problem-solving operations”. Therefore… Read More
In deterministic algorithm, for a given particular input, the computer will always produce the same output going through the same states but in case of… Read More
Cyclomatic complexity of a code section is the quantitative measure of the number of linearly independent paths in it. It is a software metric used… Read More
In our previous articles on Analysis of Algorithms, we had discussed asymptotic notations, their worst and best case performance etc. in brief. In this article,… Read More
Consider the following two functions. What are time complexities of the functions? int fun1(int n) {     if (n <= 1) return n;     return 2*fun1(n-1); }… Read More
Consider the following function int unknown(int n) { int i, j, k = 0; for (i = n/2; i
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
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
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
In the following C function, let n >= m. int gcd(n,m) {   if (n%m ==0) return m;     n = n%m;   return gcd(m, n); } How… Read More
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
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
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
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