Login
Register
Dark Mode
Brightness
Ambient Glow – Questions list
Register
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged time-complexity
2
2 votes
1
1 answer
154
154 views
GO Classes DPP | GATE CS, DA | Algorithms | Time Complexity
The algorithm $\text{ALGSORT}$ sorts an array of distinct integers using comparisons.The function $\text{MININDEX(V,i,j)}$ returns the position of the smallest element in...
GO Classes
154
views
asked
Aug 31
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-262
goclasses-cs-dpp
goclasses-cs-dpp-day-360
algorithms
python-&-dsa
goclasses-python-&-dsa-practice-questions
goclasses-algo-practice-questions
time-complexity
+
–
2
2 votes
1
1 answer
126
126 views
GO Classes DPP | GATE CS, DA | Algorithms | Bellman Ford
Consider a simple version of Bellman-Ford algorithm where we initialize $\text{distTo}[s]$ to $0$ and the rest of $\text{distTo}[v]$ to $+\infty$. Then fix an order on al...
GO Classes
126
views
asked
Aug 29
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-261
goclasses-cs-dpp
goclasses-cs-dpp-day-359
algorithms
python-&-dsa
goclasses-python-&-dsa-practice-questions
goclasses-algo-practice-questions
time-complexity
bellman-ford
+
–
1
1 vote
1
1 answer
117
117 views
GO Classes DPP | GATE CS, DA | Algorithms | Dijkstra's Algorithm
Consider Dijkstra's algorithm on a graph having $V$ vertices and $E$ edges.Suppose an indexed priority queue is not used.Instead, the tentative distances are stored only ...
GO Classes
117
views
asked
Aug 29
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-261
goclasses-cs-dpp
goclasses-cs-dpp-day-359
algorithms
python-&-dsa
goclasses-python-&-dsa-practice-questions
goclasses-algo-practice-questions
time-complexity
dijkstras-algorithm
+
–
1
1 vote
1
1 answer
106
106 views
GO Classes DPP | GATE CS, DA | Algorithms | Time Complexity
Suppose Huffman coding is implemented as follows.Initially, the $n$ symbols are stored in a min priority queue according to their frequencies.The algorithm repeatedly per...
GO Classes
106
views
asked
Aug 29
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-261
goclasses-cs-dpp
goclasses-cs-dpp-day-359
algorithms
python-&-dsa
goclasses-python-&-dsa-practice-questions
goclasses-algo-practice-questions
time-complexity
huffman-coding
greedy-algorithms
priority-queue
+
–
0
0 votes
1
1 answer
88
88 views
GO Classes DPP | GATE CS, DA | Algorithms | Time Complexity
Consider,f1(N): x = 0 for i = 0 to N - 1: x++ return xand,f2(N, R): x = 0 for i = 0 to N - 1: for j = 1; j <= R; j = j + j: x = x + f1(j) return xWhat is the order of gro...
GO Classes
88
views
asked
Aug 26
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-260
goclasses-cs-dpp
goclasses-cs-dpp-day-358
algorithms
python-&-dsa
goclasses-python-&-dsa-practice-questions
goclasses-algo-practice-questions
time-complexity
+
–
2
2 votes
1
1 answer
134
134 views
GO Classes DPP | GATE CS, DA | Algorithms | Analysis of Algorithms
The following running times are observed for a program:$$\begin{array}{|c|c|}\hlineN & \text{Running time} \\\hline1000 & 0.1\text{ seconds} \\2000 & 0.3\text{ seconds} \...
GO Classes
134
views
asked
Aug 26
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-259
goclasses-cs-dpp
goclasses-cs-dpp-day-357
algorithms
python-&-dsa
goclasses-python-&-dsa-practice-questions
goclasses-algo-practice-questions
time-complexity
numerical-answers
+
–
0
0 votes
1
1 answer
98
98 views
GO Classes DPP | GATE CS, DA | Algorithms | Sorting Complexity
Let $P$ be the problem of sorting $n\geq1$ elements using only comparisons.Consider the class of all comparison-based algorithms that correctly solve $P$.What is the asym...
GO Classes
98
views
asked
Aug 25
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-258
goclasses-cs-dpp
goclasses-cs-dpp-day-356
algorithms
python-&-dsa
goclasses-python-&-dsa-practice-questions
goclasses-algo-practice-questions
sorting
time-complexity
+
–
1
1 vote
1
1 answer
131
131 views
GO Classes DPP | GATE CS, DA | Algorithms | Divide & Conquer
Consider three recursive algorithms.Algorithm $\mathbf{1}$Divides a problem of size $N$ into two subproblems of size $N/2$ and performs constant additional work.$T_1(N)=2...
GO Classes
131
views
asked
Aug 24
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-257
goclasses-cs-dpp
goclasses-cs-dpp-day-355
algorithms
python-&-dsa
goclasses-python-&-dsa-practice-questions
goclasses-algo-practice-questions
time-complexity
divide-and-conquer
+
–
2
2 votes
1
1 answer
103
103 views
GO Classes DPP | GATE CS, DA | Algorithms | Complexity Analysis
Consider the following recursive function $\texttt{Pot}$, which computes $x^n$, where $x$ is real and $n$ is an integer.Pot(x, n): if x == 0: return 0 if n == 0: return 1...
GO Classes
103
views
asked
Aug 24
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-257
goclasses-cs-dpp
goclasses-cs-dpp-day-355
algorithms
python-&-dsa
goclasses-python-&-dsa-practice-questions
goclasses-algo-practice-questions
time-complexity
+
–
0
0 votes
1
1 answer
136
136 views
GO Classes DPP | GATE DA | Python & DSA | Code Complexity
Given the following recursive Python function :def fun(n): if n <= 1: return n else: return fun(n - 1) + fun(n - 2)What is the time complexity of $\texttt{fun(n)}$?$O(n)$...
GO Classes
136
views
asked
Jul 29
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-237
python-&-dsa
goclasses-python-&-dsa-practice-questions
time-complexity
+
–
4
4 votes
1
1 answer
127
127 views
GO Classes DPP | GATE CS | Algorithms | Code Complexity
Consider the following recursive C function:int fun(int n) { if (n <= 1) { return n; } else { return fun(n - 1) + fun(n - 2); } }What is the time complexity of $\texttt{f...
GO Classes
127
views
asked
Jul 29
Algorithms
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-335
algorithms
goclasses-algo-practice-questions
time-complexity
+
–
1
1 vote
1
1 answer
131
131 views
GO Classes DPP | GATE CS | Algorithms | Code Complexity
Consider the following C code:int total = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { for (int k = 0; k < n; k++) { total += i * j * k; } } }What is th...
GO Classes
131
views
asked
Jul 29
Algorithms
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-335
algorithms
goclasses-algo-practice-questions
time-complexity
+
–
0
0 votes
1
1 answer
104
104 views
GO Classes DPP | GATE DA | Python & DSA | Loop Complexity
Consider the following code:sum = 0 for i in range(n): sum += i k = n while k 0: k = k // 2What is the time complexity?$O(n)$ $O(\log n)$ $O(n \log n)$ $O(n^2)$
GO Classes
104
views
asked
Jul 29
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-236
python-&-dsa
goclasses-python-&-dsa-practice-questions
time-complexity
+
–
3
3 votes
1
1 answer
127
127 views
GO Classes DPP | GATE CS | Algorithms | Loop Complexity
Consider the following C code:int sum = 0; for (int i = 0; i < n; i++) { sum += i; int k = n; while (k 0) { k = k / 2; } }What is the time complexity?$O(n)$ $O(\log n)$ ...
GO Classes
127
views
asked
Jul 29
Algorithms
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-334
algorithms
goclasses-algo-practice-questions
time-complexity
+
–
1
1 vote
1
1 answer
86
86 views
Merge sort doubt
for optimized merge sort we can say : It is possible to modify the standard algorithm to check if the last element of the left half is less than or equal to the first ele...
lks_07
86
views
asked
Jul 9
Algorithms
merge-sort
time-complexity
+
–
1
1 vote
2
2 answers
138
138 views
GO Classes DPP | GATE DA | Python & DSA | Growth Bounds
Which of the following expressions correctly describe $\mathrm{T}(n) = n^2 \log n$?Select all that apply.$\mathrm{O}(n^2)$$\mathrm{\Theta(n^2)}$$\mathrm{\Omega(n^2)}$$\ma...
GO Classes
138
views
asked
Jul 7
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-218
python-&-dsa
goclasses-python-&-dsa-practice-questions
time-complexity
+
–
0
0 votes
1
1 answer
107
107 views
GO Classes DPP | GATE DA | Python & DSA | Halving Loop
Describe the order of growth of the function below.def bonk(n): sum = 0 while n >= 2: sum += n n = n / 2 return sumExponentialLogarithmicLinearQuadratic
GO Classes
107
views
asked
Jul 7
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-218
python-&-dsa
goclasses-python-&-dsa-practice-questions
time-complexity
+
–
0
0 votes
1
1 answer
103
103 views
GO Classes DPP | GATE DA | Python & DSA | Sorting Lower Bound
Let $A$ be a comparison-based sorting algorithm for sorting an array of length $n$, and let $T$ be the corresponding decision tree.Which of the following are necessarily ...
GO Classes
103
views
asked
Jul 7
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-218
python-&-dsa
goclasses-python-&-dsa-practice-questions
time-complexity
multiple-selects
+
–
0
0 votes
1
1 answer
90
90 views
GO Classes DPP | GATE DA | Python & DSA | Big-O Definition
Recall that the formal definition of Big-O is:$f(n)$ is $\operatorname{O}(g(n))$ if there exist some values $c$, $n_0 0$such that $f(n) \leq c(g(n))$ for all $n \geq n_0...
GO Classes
90
views
asked
Jul 7
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-218
python-&-dsa
goclasses-python-&-dsa-practice-questions
time-complexity
+
–
0
0 votes
1
1 answer
98
98 views
GO Classes DPP | GATE DA | Python & DSA | Upper Bound
Which of the following algorithms runs in worst-case $\mathrm{O(n^2)}$ time?Select all that apply.MergeSort, where $\mathrm{n}$ is the number of elements we are sorting.Q...
GO Classes
98
views
asked
Jul 7
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-218
python-&-dsa
goclasses-python-&-dsa-practice-questions
time-complexity
multiple-selects
+
–
3
3 votes
2
2 answers
145
145 views
GO Classes DPP | GATE DA | Python & DSA | Membership Cost
Let $\text{L}$ contain $\text{N}$ items. What is the Big-O efficiency of the following function?def countSquares(L): count = 0 for item in L: square = item 2 if item != s...
GO Classes
145
views
asked
Jul 6
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-217
python-&-dsa
goclasses-python-&-dsa-practice-questions
time-complexity
+
–
1
1 vote
2
2 answers
118
118 views
GO Classes DPP | GATE DA | Python & DSA | Dependent Loops
Let $\text{N = n}$. What is the Big-O efficiency of the function below?def f1(n): ret = [] for i in range(n): for j in range(i + 1, n): ret.append(i + j) return ret$\math...
GO Classes
118
views
asked
Jul 6
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-217
python-&-dsa
goclasses-python-&-dsa-practice-questions
time-complexity
+
–
1
1 vote
2
2 answers
109
109 views
GO Classes DPP | GATE DA | Python & DSA | Tricky Loop
Describe the order of growth of the function below.def bonk(n): sum = 0 while n >= 2: sum += n n = n / 2 return sumConstantLogarithmicLinearQuadraticExponentialNone of th...
GO Classes
109
views
asked
Jul 6
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-217
python-&-dsa
goclasses-python-&-dsa-practice-questions
time-complexity
+
–
1
1 vote
2
2 answers
102
102 views
GO Classes DPP | GATE DA | Python & DSA | Halving Input
What is the order of growth of $\texttt{foo}$ in terms of $\texttt{n}$, where $\texttt{n}$ is the length of $\texttt{lst}$?Assume slicing a list and calling $\texttt{len}...
GO Classes
102
views
asked
Jul 6
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-217
python-&-dsa
goclasses-python-&-dsa-practice-questions
time-complexity
+
–
1
1 vote
2
2 answers
109
109 views
GO Classes DPP | GATE DA | Python & DSA | Nested Calls
What is the order of growth of $\texttt{bar}$ in terms of $\texttt{n}$?def bar(n): i, sum = 1, 0 while i <= n: sum += biz(n) i += 1 return sum def biz(n): i, sum = 1, 0 w...
GO Classes
109
views
asked
Jul 6
Algorithms
goclasses
goclasses-da-dpp
goclasses-da-dpp-day-217
python-&-dsa
goclasses-python-&-dsa-practice-questions
time-complexity
+
–
2
2 votes
2
2 answers
167
167 views
UGC NET CSE | December 2025 | Part 2 | Question: 41
Which of the following is correct order of increasing time complexity of algorithmsTower of Hanoi with $n$ disk.Binary search given $n$ sorted numbers.Heap sort given $n$...
Shubham Sharma 2
167
views
asked
Apr 19
Algorithms
ugcnetcse-dec2025
time-complexity
algorithm-design
sorting
recursion
matrix
searching
+
–
0
0 votes
0
0 answers
110
110 views
UGC NET CSE | December 2025 | Part 2 | Question: 42
Arrange the following algorithms from the most efficient to least efficient based on their time complexity.Kruskal's AlgorithmBreadth first search AlgorithmBellman-Ford A...
Shubham Sharma 2
110
views
asked
Apr 19
Algorithms
ugcnetcse-dec2025
algorithms
time-complexity
graph-algorithms
+
–
9
9 votes
2
2 answers
2.0k
2.0k views
GATE CSE 2026 | Set 2 | Question: 27
Let $G$ be a weighted directed acyclic graph with $m$ edges and $n$ vertices. Given $G$ and a source vertex $s$ in $G$, which one of the following options gives the worst...
gatecse
2.0k
views
asked
Feb 23
Algorithms
gatecse-2026-set2
algorithms
shortest-path
directed-acyclic-graph
time-complexity
two-marks
+
–
9
9 votes
6
6 answers
3.8k
3.8k views
GATE CSE 2026 | Set 2 | Question: 28
Consider an array $A$ of integers of size $n$. The indices of $A$ run from $1$ to $n$. An algorithm is to be designed to check whether $A$ satisfies the condition given b...
gatecse
3.8k
views
asked
Feb 23
Algorithms
gatecse-2026-set2
algorithms
time-complexity
two-marks
+
–
13
13 votes
7
7 answers
2.3k
2.3k views
GATE CSE 2026 | Set 1 | Question: 7
Consider the following recurrence relations:For all $n>1$,\[\begin{array}{c}T_{1}(n)=4 T_{1}\left(\frac{n}{2}\right)+T_{2}(n) \\T_{2}(n)=5 T_{2}\left(\frac{n}{4}\right)+\...
gatecse
2.3k
views
asked
Feb 23
Algorithms
gatecse-2026-set1
algorithms
time-complexity
one-mark
+
–
Page:
1
2
3
4
5
6
...
60
next »