Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Search results for time-complexity
4
votes
4
answers
1
NIELIT 2016 DEC Scientist B (CS) - Section B: 16
Two main measures for the efficiency of an algorithm are: Processor and Memory Complexity and Capacity Time and Space Data and Space
Two main measures for the efficiency of an algorithm are:Processor and MemoryComplexity and CapacityTime and SpaceData and Space
admin
84.2k
views
admin
asked
Mar 31, 2020
Algorithms
nielit2016dec-scientistb-cs
algorithms
time-complexity
+
–
79
votes
7
answers
2
GATE CSE 2008 | Question: 40
The minimum number of comparisons required to determine if an integer appears more than $\frac{n}{2}$ times in a sorted array of $n$ integers is $\Theta(n)$ $\Theta(\log n)$ $\Theta(\log^*n)$ $\Theta(1)$
The minimum number of comparisons required to determine if an integer appears more than $\frac{n}{2}$ times in a sorted array of $n$ integers is$\Theta(n)$$\Theta(\log n)...
Kathleen
36.3k
views
Kathleen
asked
Sep 12, 2014
Algorithms
gatecse-2008
normal
algorithms
time-complexity
+
–
47
votes
8
answers
3
GATE CSE 2019 | Question: 37
There are $n$ unsorted arrays: $A_1, A_2, \dots, A_n$. Assume that $n$ is odd.Each of $A_1, A_2, \dots, A_n$ contains $n$ distinct elements. There are no common elements between any two arrays. The worst-case time complexity of computing the median of the medians of $A_1, A_2, \dots , A_n$ is $O(n)$ $O(n \: \log \: n)$ $O(n^2)$ $\Omega (n^2 \log n)$
There are $n$ unsorted arrays: $A_1, A_2, \dots, A_n$. Assume that $n$ is odd.Each of $A_1, A_2, \dots, A_n$ contains $n$ distinct elements. There are no common elements ...
Arjun
33.2k
views
Arjun
asked
Feb 7, 2019
Algorithms
gatecse-2019
algorithms
time-complexity
2-marks
+
–
64
votes
15
answers
4
GATE CSE 2007 | Question: 15, ISRO2016-26
Consider the following segment of C-code: int j, n; j = 1; while (j <= n) j = j * 2; The number of comparisons made in the execution of the loop for any $n > 0$ is: $\lceil \log_2n \rceil +1$ $n$ $\lceil \log_2n \rceil$ $\lfloor \log_2n \rfloor +1$
Consider the following segment of C-code:int j, n; j = 1; while (j <= n) j = j * 2;The number of comparisons made in the execution of the loop for any $n 0$ is:$\lceil \...
Arjun
36.7k
views
Arjun
asked
Jul 6, 2016
Algorithms
gatecse-2007
algorithms
time-complexity
normal
isro2016
+
–
24
votes
7
answers
5
GATE CSE 2021 Set 1 | Question: 30
Consider the following recurrence relation. $T\left ( n \right )=\left\{\begin{array} {lcl} T(n ∕ 2)+T(2n∕5)+7n & \text{if} \; n>0\\1 & \text{if}\; n=0 \end{array}\right.$ Which one of the following options is correct? $T(n)=\Theta (n^{5/2})$ $T(n)=\Theta (n\log n)$ $T(n)=\Theta (n)$ $T(n)=\Theta ((\log n)^{5/2})$
Consider the following recurrence relation.$$T\left ( n \right )=\left\{\begin{array} {lcl} T(n ∕ 2)+T(2n∕5)+7n & \text{if} \; n>0\\1 & \text{if}\; n=0 \end{array}\r...
Arjun
23.5k
views
Arjun
asked
Feb 18, 2021
Algorithms
gatecse-2021-set1
algorithms
recurrence-relation
time-complexity
2-marks
+
–
80
votes
12
answers
6
GATE CSE 2014 Set 1 | Question: 42
Consider the following pseudo code. What is the total number of multiplications to be performed? D = 2 for i = 1 to n do for j = i to n do for k = j + 1 to n do D = D * 3 Half of the product of the $3$ consecutive integers. One-third of the product of the $3$ consecutive integers. One-sixth of the product of the $3$ consecutive integers. None of the above.
Consider the following pseudo code. What is the total number of multiplications to be performed?D = 2 for i = 1 to n do for j = i to n do for k = j + 1 to n do D = D * 3H...
go_editor
34.1k
views
go_editor
asked
Sep 28, 2014
Algorithms
gatecse-2014-set1
algorithms
time-complexity
normal
+
–
50
votes
8
answers
7
GATE CSE 2007 | Question: 45
What is the $\text{time complexity}$ of the following recursive function? int DoSomething (int n) { if (n <= 2) return 1; else return (DoSomething (floor (sqrt(n))) + n); } $\Theta(n^2)$ $\Theta(n \log_2n)$ $\Theta(\log_2n)$ $\Theta(\log_2\log_2n)$
What is the $\text{time complexity}$ of the following recursive function?int DoSomething (int n) { if (n <= 2) return 1; else return (DoSomething (floor (sqrt(n))) + n); ...
Kathleen
31.7k
views
Kathleen
asked
Sep 21, 2014
Algorithms
gatecse-2007
algorithms
time-complexity
normal
+
–
41
votes
7
answers
8
GATE CSE 2008 | Question: 47
We have a binary heap on $n$ elements and wish to insert $n$ more elements (not necessarily one after another) into this heap. The total time required for this is $\Theta(\log n)$ $\Theta(n)$ $\Theta(n\log n)$ $\Theta(n^2)$
We have a binary heap on $n$ elements and wish to insert $n$ more elements (not necessarily one after another) into this heap. The total time required for this is$\Theta(...
Kathleen
21.5k
views
Kathleen
asked
Sep 12, 2014
Algorithms
gatecse-2008
algorithms
time-complexity
normal
+
–
106
votes
8
answers
9
GATE CSE 2003 | Question: 66
The cube root of a natural number $n$ is defined as the largest natural number $m$ such that $(m^3 \leq n)$ . The complexity of computing the cube root of $n$ ($n$ is represented by binary notation) is $O(n)$ but not $O(n^{0.5})$ $O(n^{0.5})$ ... constant $m>0$ $O( (\log \log n)^k )$ for some constant $k > 0.5$, but not $O( (\log \log n)^{0.5} )$
The cube root of a natural number $n$ is defined as the largest natural number $m$ such that $(m^3 \leq n)$ . The complexity of computing the cube root of $n$ ($n$ is rep...
Nishant T-rex
23.9k
views
Nishant T-rex
asked
Sep 2, 2014
Algorithms
gatecse-2003
algorithms
time-complexity
normal
+
–
96
votes
6
answers
10
GATE CSE 2016 Set 2 | Question: 15
$N$ items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decrease-key operation, a pointer is provided to the record on which the operation is to be performed. An algorithm performs the following operations ... together? $O(\log^{2} N)$ $O(N)$ $O(N^{2})$ $\Theta\left(N^{2}\log N\right)$
$N$ items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decrease-key operation, a pointer is...
Akash Kanase
34.0k
views
Akash Kanase
asked
Feb 12, 2016
DS
gatecse-2016-set2
data-structures
linked-list
time-complexity
normal
algorithms
+
–
57
votes
6
answers
11
GATE CSE 1999 | Question: 1.13
Suppose we want to arrange the $n$ numbers stored in any array such that all negative values occur before all positive ones. Minimum number of exchanges required in the worst case is $n-1$ $n$ $n+1$ None of the above
Suppose we want to arrange the $n$ numbers stored in any array such that all negative values occur before all positive ones. Minimum number of exchanges required in the w...
Kathleen
19.6k
views
Kathleen
asked
Sep 23, 2014
Algorithms
gate1999
algorithms
time-complexity
normal
+
–
66
votes
10
answers
12
GATE CSE 2006 | Question: 54
Given two arrays of numbers $a_{1},...,a_{n}$ and $b_{1},...,b_{n}$ where each number is $0$ or $1$, the fastest algorithm to find the largest span $(i, j)$ such that $ a_{i}+a_{i+1}+\dots+a_{j}=b_{i}+b_{i+1}+\dots+b_{j}$ ... time in the key comparison mode Takes $\Theta (n)$ time and space Takes $O(\sqrt n)$ time only if the sum of the $2n$ elements is an even number
Given two arrays of numbers $a_{1},...,a_{n}$ and $b_{1},...,b_{n}$ where each number is $0$ or $1$, the fastest algorithm to find the largest span $(i, j)$ such that $ a...
Rucha Shelke
28.5k
views
Rucha Shelke
asked
Sep 26, 2014
Algorithms
gatecse-2006
algorithms
normal
algorithm-design
time-complexity
+
–
64
votes
8
answers
13
GATE CSE 2007 | Question: 44
In the following C function, let $n \geq m$. int gcd(n,m) { if (n%m == 0) return m; n = n%m; return gcd(m,n); } How many recursive calls are made by this function? $\Theta(\log_2n)$ $\Omega(n)$ $\Theta(\log_2\log_2n)$ $\Theta(\sqrt{n})$
In the following C function, let $n \geq m$.int gcd(n,m) { if (n%m == 0) return m; n = n%m; return gcd(m,n); }How many recursive calls are made by this function?$\Theta(\...
Kathleen
26.4k
views
Kathleen
asked
Sep 21, 2014
Algorithms
gatecse-2007
algorithms
recursion
time-complexity
normal
+
–
40
votes
6
answers
14
GATE CSE 2008 | Question: 74
Consider the following C functions: int f1 (int n) { if(n == 0 || n == 1) return n; else return (2 * f1(n-1) + 3 * f1(n-2)); } int f2(int n) { int i; int X[N], Y[N], Z[N]; X[0] = Y[0] = Z[0] = 0; X[1] = 1; Y[1] = 2; Z[1] = 3; for(i = 2 ... $f2(n)$ are $\Theta(n)$ and $\Theta(n)$ $\Theta(2^n)$ and $\Theta(n)$ $\Theta(n)$ and $\Theta(2^n)$ $\Theta(2^n)$ and $\Theta(2^n)$
Consider the following C functions:int f1 (int n) { if(n == 0 || n == 1) return n; else return (2 * f1(n-1) + 3 * f1(n-2)); } int f2(int n) { int i; int X[N], Y[N], Z[N];...
Kathleen
18.7k
views
Kathleen
asked
Sep 12, 2014
Algorithms
gatecse-2008
algorithms
time-complexity
normal
+
–
37
votes
10
answers
15
GATE CSE 1992 | Question: 01,ix
Complexity of Kruskal’s algorithm for finding the minimum spanning tree of an undirected graph containing $n$ vertices and $m$ edges if the edges are sorted is _______
Complexity of Kruskal’s algorithm for finding the minimum spanning tree of an undirected graph containing $n$ vertices and $m$ edges if the edges are sorted is _______
Kathleen
17.3k
views
Kathleen
asked
Sep 12, 2014
Algorithms
gate1992
spanning-tree
algorithms
time-complexity
easy
fill-in-the-blanks
+
–
94
votes
5
answers
16
GATE CSE 2015 Set 1 | Question: 40
An algorithm performs $(\log N)^{\frac{1}{2}}$ find operations , $N$ insert operations, $(\log N)^{\frac{1}{2}}$ delete operations, and $(\log N)^{\frac{1}{2}}$ decrease-key operations on a set of data ... if the goal is to achieve the best total asymptotic complexity considering all the operations? Unsorted array Min - heap Sorted array Sorted doubly linked list
An algorithm performs $(\log N)^{\frac{1}{2}}$ find operations , $N$ insert operations, $(\log N)^{\frac{1}{2}}$ delete operations, and $(\log N)^{\frac{1}{2}}$ decrease-...
makhdoom ghaya
23.5k
views
makhdoom ghaya
asked
Feb 13, 2015
Algorithms
gatecse-2015-set1
algorithms
data-structures
normal
time-complexity
+
–
50
votes
7
answers
17
GATE CSE 2017 Set 2 | Question: 38
Consider the following C function int fun(int n) { int i, j; for(i=1; i<=n; i++) { for (j=1; j<n; j+=i) { printf("%d %d", i, j); } } } Time complexity of $fun$ in terms of $\Theta$ notation is $\Theta(n \sqrt{n})$ $\Theta(n^2)$ $\Theta(n \: \log n)$ $\Theta(n^2 \log n)$
Consider the following C functionint fun(int n) { int i, j; for(i=1; i<=n; i++) { for (j=1; j<n; j+=i) { printf("%d %d", i, j); } } }Time complexity of $fun$ in terms of ...
Madhav
24.4k
views
Madhav
asked
Feb 14, 2017
Algorithms
gatecse-2017-set2
algorithms
time-complexity
+
–
14
votes
4
answers
18
GATE CSE 2021 Set 2 | Question: 8
What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size $n$? $\Theta ( \sqrt{n})$ $\Theta (\log _2(n))$ $\Theta(n^2)$ $\Theta(n)$
What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size $n$?$\Theta ( \sqrt{n})$$\Theta (\log _2(n))$$\Theta...
Arjun
11.8k
views
Arjun
asked
Feb 18, 2021
Algorithms
gatecse-2021-set2
algorithms
binary-search
time-complexity
1-mark
+
–
66
votes
13
answers
19
GATE CSE 2004 | Question: 82
Let $A[1,\ldots,n]$ be an array storing a bit ($1$ or $0$) at each location, and $f(m)$ is a function whose time complexity is $\Theta(m)$. Consider the following program fragment written in a C like language: counter = 0; for (i=1; i<=n; i++) { if ( ... The complexity of this program fragment is $\Omega(n^2)$ $\Omega (n\log n) \text{ and } O(n^2)$ $\Theta(n)$ $o(n)$
Let $A[1,\ldots,n]$ be an array storing a bit ($1$ or $0$) at each location, and $f(m)$ is a function whose time complexity is $\Theta(m)$. Consider the following program...
Kathleen
20.0k
views
Kathleen
asked
Sep 18, 2014
Algorithms
gatecse-2004
algorithms
time-complexity
normal
+
–
28
votes
6
answers
20
GATE CSE 2008 | Question: 7
The most efficient algorithm for finding the number of connected components in an undirected graph on $n$ vertices and $m$ edges has time complexity $\Theta(n)$ $\Theta(m)$ $\Theta(m+n)$ $\Theta(mn)$
The most efficient algorithm for finding the number of connected components in an undirected graph on $n$ vertices and $m$ edges has time complexity$\Theta(n)$$\Theta(m)$...
Kathleen
13.2k
views
Kathleen
asked
Sep 11, 2014
Algorithms
gatecse-2008
algorithms
graph-algorithms
time-complexity
normal
+
–
Page:
1
2
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register