Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Webpage for Algorithms
Recent questions tagged algorithms
0
votes
0
answers
1441
#Algorithms Space Complexity Vs Auxiliary Space Complexity?
I'm kind of confused between these two terms as for example - the Auxiliary space of merge sort, heapsort and insertion sort is O(1) whereas Space complexity of merge sort, insertion sort, heapsort is O(n). So, if ... ? Furthermore I know - Space Complexity = Auxiliary Space + space taken by also wrt input. Kindly help, thank you!
I'm kind of confused between these two terms as for example - the Auxiliary space of merge sort, heapsort and insertion sort is O(1) whereas Space complexity of merge sor...
iarnav
597
views
iarnav
asked
Jun 26, 2018
Algorithms
algorithms
space-complexity
+
–
0
votes
1
answer
1442
what is the tightest bound for the below functions ?
n2 + O(n2) = Theta(n2) I am not getting how can we say that tightest bound is in terms of theta , because theta(n2 ) implicitly implies Big-Omega(n2 ) and Big O(n2 ) , Now If we say the function f(n) is Big-Omega(n2 ... will never get a function greater than n2 so how can we say the tightest bound to be Big-Omega(n2 ) ? Please explain briefly .
n2 + O(n2) = Theta(n2) I am not getting how can we say that tightest bound is in terms of theta , because theta(n2 ) implicitly implies Big-Omega(n2 ) and Big O(n2 ) , ...
radha gogia
662
views
radha gogia
asked
Jun 24, 2018
Algorithms
algorithms
asymptotic-notation
+
–
1
votes
1
answer
1443
#DS Inserting elements into Min Heap?
The number of distinct min heap are possible with keys 1, 2, 3, 4, 5 are ________. I know, there are variance of this question for Max heap and even for Min heap, the answer won't change, but I just wanna know if my technique is right or not. == ... value. -> Lastly the right sub tree => 1C1 = 1 Totally - 1*4C3*1*2*1 = 8. Is this approach correct?
The number of distinct min heap are possible with keys 1, 2, 3, 4, 5 are ________.I know, there are variance of this question for Max heap and even for Min heap, the answ...
iarnav
625
views
iarnav
asked
Jun 24, 2018
DS
algorithms
binary-heap
data-structures
+
–
0
votes
0
answers
1444
#DS Min Heaps Possible?
The number of possible min-heaps containing each value from {1,1,1,1,1,1,1} exactly once is _______ This is a variance of Gate 2018 question and how will we deal if all values are same?
The number of possible min-heaps containing each value from {1,1,1,1,1,1,1} exactly once is _______This is a variance of Gate 2018 question and how will we deal if all va...
iarnav
281
views
iarnav
asked
Jun 24, 2018
DS
algorithms
binary-heap
data-structures
+
–
0
votes
1
answer
1445
algo self doubt
consider the following c program A(n) { if(n<=1) return(n2 +n+1) else return(5A(n/2)+3A(n/2)+MA(n)) } where MA(n) has complexity O(n2). 1.what is the recurrence relation for value.? 2.what is the the recurrence relation for time complexity?
consider the following c program A(n){if(n<=1)return(n2 +n+1)elsereturn(5A(n/2)+3A(n/2)+MA(n))}where MA(n) has complexity O(n2).1.what is the recurrence relation for valu...
eyeamgj
418
views
eyeamgj
asked
Jun 24, 2018
Algorithms
algorithms
recurrence-relation
time-complexity
self-doubt
+
–
0
votes
0
answers
1446
Asymptotic Complexity
$T\left ( n,c \right )=\Theta \left ( n \right )$ for $c\leq 2$ $T\left ( c,n \right )=\Theta \left ( n \right )$ for $c\leq 2$ $T\left ( n,n \right )=\Theta \left ( n \right )+T\left ( n,\frac{n}{2} \right )$ How to find complexity for this recurrence relation?
$T\left ( n,c \right )=\Theta \left ( n \right )$ for $c\leq 2$$T\left ( c,n \right )=\Theta \left ( n \right )$ for $c\leq 2$$T\left ( n,n \right )=\Theta \left ( n \rig...
srestha
463
views
srestha
asked
Jun 22, 2018
Algorithms
algorithms
time-complexity
asymptotic-notation
+
–
1
votes
1
answer
1447
#DataStructure Heaps Self Doubt.
In a binary Heap of 100 elements time taken to find the 99th element? or in a binary heap on "n" elements, time taken to find (n-1)th element? Note ; I'm not asking about smallest or largest, but simply the 99th element.
In a binary Heap of 100 elements time taken to find the 99th element?or in a binary heap on "n" elements, time taken to find (n-1)th element? Note ; I'm not asking about ...
iarnav
476
views
iarnav
asked
Jun 21, 2018
DS
algorithms
binary-heap
+
–
1
votes
0
answers
1448
Made easy
Manoj Kumar Pandey
174
views
Manoj Kumar Pandey
asked
Jun 20, 2018
Algorithms
algorithms
+
–
0
votes
1
answer
1449
#Algorithms Can Heapsort be applied on Min Heap Data Structure?
I've read and been told that Heapsort can only be applied on Max heap, but this article for G4G states otherwise - https://www.geeksforgeeks.org/heap-sort-for-decreasing-order-using-min-heap/ So, is it true that HS can be applied also on Min heap?
I've read and been told that Heapsort can only be applied on Max heap, but this article for G4G states otherwise - https://www.geeksforgeeks.org/heap-sort-for-decreasing-...
iarnav
702
views
iarnav
asked
Jun 20, 2018
Algorithms
binary-heap
algorithms
+
–
0
votes
0
answers
1450
Testbook Test Series: Algorithms - Graph Algorithms
Consider the following statements: $A.$ In a weighted undirected graph $G = (V, E, w)$, breadth-first search from a vertex s finds single-source shortest paths from s (via parent pointers) in $O(V + E)$ time. $B.$ In a ... , then the breadth-first search order of vertices is a valid order in which to tackle the tasks. Which of the above is TRUE?
Consider the following statements:$A.$ In a weighted undirected graph $G = (V, E, w)$, breadth-first search from a vertex s finds single-source shortest paths from s (via...
Sandy Sharma
1.2k
views
Sandy Sharma
asked
Jun 19, 2018
Algorithms
testbook-test-series
algorithms
graph-algorithms
+
–
0
votes
1
answer
1451
Introduction to algorithms by cormen
I am just starting with algorithms and as I have no source specifically aimed for gate prep so I am gonna go ahead with clrs(introduction to algorithms). Can someone list the topics which are relevant for GATE ? I am facing a ... linear time sorting algorithms like counting sort ,radix sort and the algorithms for median finding . Any help would be appreciated
I am just starting with algorithms and as I have no source specifically aimed for gate prep so I am gonna go ahead with clrs(introduction to algorithms). Can someone list...
Suyash Musalgaonkar
878
views
Suyash Musalgaonkar
asked
Jun 19, 2018
Algorithms
algorithms
reference-book
+
–
0
votes
1
answer
1452
Heap Sort
Would it be possible to implement a variant of heapsort based on a perfectly balanced ternary structure in which the children of node $i$ are at positions $3i - 1, 3i$, and $3i + 1$, and if so what would be the advantages and disadvantages of the new method?
Would it be possible to implement a variant of heapsort based on a perfectly balanced ternary structure in which the children of node $i$ are at positions $3i - 1, 3i$, a...
Balaji Jegan
576
views
Balaji Jegan
asked
Jun 18, 2018
Algorithms
algorithms
data-structures
heap-sort
+
–
2
votes
1
answer
1453
Algorithm
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)} \\ f3(n) = nlogn \\ f4(n) = n^{(logn)}$ How $n^{3/2}$ is greater than $n^{logn}$
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)} \\ f3(n) = nl...
shipra tressa
1.6k
views
shipra tressa
asked
Jun 18, 2018
Algorithms
algorithms
time-complexity
+
–
0
votes
1
answer
1454
time complexity
what is the time complexity of the $pow(m,n)$ ?
what is the time complexity of the $pow(m,n)$ ?
vijju532
402
views
vijju532
asked
Jun 17, 2018
Algorithms
time-complexity
algorithms
+
–
0
votes
0
answers
1455
How to calculate the average case time complexity in linear search for a successful and unsuccessful search ?
Successful Search we assume that the probability of searching or finding an element at each location is same , then if we have n elements so probability is $1/n$...Also w...
radha gogia
1.3k
views
radha gogia
asked
Jun 17, 2018
Algorithms
algorithms
time-complexity
linear-search
+
–
0
votes
1
answer
1456
Time complexity
$T(n) = T(n-2) + 2logn, \text{ if } n>1 \\ =1, \text{ if } n=1$ Find the Time Complexity.
$T(n) = T(n-2) + 2logn, \text{ if } n>1 \\ =1, \text{ if } n=1$Find the Time Complexity.
shweta sah
304
views
shweta sah
asked
Jun 17, 2018
Algorithms
algorithms
time-complexity
recurrence-relation
+
–
0
votes
1
answer
1457
Time complexity
What is the 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_2 n)$ $\theta(\log_2 n)$ $\theta(\log_2 \log_2 n)$
What is the 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)$...
shweta sah
564
views
shweta sah
asked
Jun 17, 2018
Algorithms
algorithms
time-complexity
recurrence-relation
+
–
1
votes
0
answers
1458
Time Complexity
What will be the time complexity of the following algorithm ? A(n){ if(n<=1) return 1; for(i=1;i<n;i++){ for(j=0;j<3;j++){ A(n-1) } } }
What will be the time complexity of the following algorithm ?A(n){if(n<=1) return 1;for(i=1;i<n;i++){ for(j=0;j<3;j++){ A(n-1) } }}
kartikeya2812
401
views
kartikeya2812
asked
Jun 16, 2018
Algorithms
time-complexity
algorithms
asymptotic-notation
recursion
+
–
0
votes
1
answer
1459
me wk book
let T be a minimum cost spanning tree of G. suppose that ewe decreased the weight of one of the edge in T.then to check modified T is MST or not how much tym will take??? O(1) or O(n)?????
let T be a minimum cost spanning tree of G. suppose that ewe decreased the weight of one of the edge in T.then to check modified T is MST or not how much tym will take???...
eyeamgj
450
views
eyeamgj
asked
Jun 16, 2018
Algorithms
algorithms
minimum-spanning-tree
time-complexity
made-easy-booklet
+
–
0
votes
0
answers
1460
Sorting
You are asked to sort 15 randomly generated numbers. One should prefer - 1. Bubble Sort 2. Quick Sort 3. Merge Sort 4. Heap Sort Please explain why others 3 sorting algorithms except the answer can't be used ?
You are asked to sort 15 randomly generated numbers. One should prefer - 1. Bubble Sort2. Quick Sort3. Merge Sort4. Heap Sort Please explain why others 3 sorting algorith...
Rahul Ranjan 1
681
views
Rahul Ranjan 1
asked
Jun 15, 2018
Algorithms
sorting
algorithms
time-complexity
heap-sort
merge-sort
+
–
0
votes
0
answers
1461
Fibonacci number
How "a fibonacci algorithm runs in polynomial time in n but the optimal running time is exponential in n."? Is it possible to running same algorithm in both polynomial and exponential time?
How "a fibonacci algorithm runs in polynomial time in n but the optimal running time is exponential in n."?Is it possible to running same algorithm in both polynomial and...
srestha
460
views
srestha
asked
Jun 15, 2018
Algorithms
algorithms
+
–
0
votes
1
answer
1462
workbook
An unordered list contains n distinct elements. The number of comparisons to find an element in this list that is neither 2nd maximum nor 2nd minimum is Θ(nlogn) Θ(n) Θ(logn) Θ(1)
An unordered list contains n distinct elements. The number of comparisons to find an element in this list that is neither 2nd maximum nor 2nd minimum isΘ(nlogn)Θ(n)Θ(l...
eyeamgj
564
views
eyeamgj
asked
Jun 15, 2018
Algorithms
algorithms
time-complexity
easy
sorting
+
–
0
votes
0
answers
1463
Backtracking Vs Branch and Bound Paradigm Vs Dynamic Programming Vs Greedy Algorithm
I am getting confused among the terms : Backtracking, Branch and Bound Paradigm, Dynamic Programming and Greedy Algorithm. Can anyone tell their similarities and differences?
I am getting confused among the terms : Backtracking, Branch and Bound Paradigm, Dynamic Programming and Greedy Algorithm.Can anyone tell their similarities and differenc...
Balaji Jegan
1.0k
views
Balaji Jegan
asked
Jun 14, 2018
Algorithms
algorithms
+
–
0
votes
1
answer
1464
Space Complexity of Build Max Heap
Since Heapify is a recursive function, its space complexity is $O(logn)$ because of the stack space required for recursion. I also read that space complexity of heapsort is $O(1)$ beause of the explanation here - https://gateoverflow.in/79909/ ... complexity of build heap is $O(logn)$ then heapsorts complexity should also be the same . What am I missing here ?
Since Heapify is a recursive function, its space complexity is $O(logn)$ because of the stack space required for recursion.I also read that space complexity of heapsort i...
Hardik Maheshwari
4.8k
views
Hardik Maheshwari
asked
Jun 14, 2018
Algorithms
space-complexity
algorithms
binary-heap
heap-sort
+
–
0
votes
0
answers
1465
data structure
how does linux kernel uses the red black tree property ???elabourate
how does linux kernel uses the red black tree property ???elabourate
vijju532
194
views
vijju532
asked
Jun 13, 2018
Algorithms
data-structures
algorithms
tree
+
–
0
votes
0
answers
1466
Data structure
I have a matrix A (m * n) and another matrix B (n * k) of size 1,000000000000000000 (this means it cannot directly save it into memory) . It has been organized as a splay tree. You have to multiply them and give me C (m * k) . What datastructure would be use ? How would implement it ?
I have a matrix A (m * n) and another matrix B (n * k) of size 1,000000000000000000 (this means it cannot directly save it into memory) . It has been organized as a spla...
vijju532
147
views
vijju532
asked
Jun 13, 2018
Algorithms
data-structures
algorithms
+
–
0
votes
1
answer
1467
#DataStructure Time Complexity in Sorted Array.
Given an sorted array in descending order, what will be the time complexity to delete the minimum element from this array?
Given an sorted array in descending order, what will be the time complexity to delete the minimum element from this array?
iarnav
897
views
iarnav
asked
Jun 12, 2018
DS
algorithms
time-complexity
array
data-structures
+
–
0
votes
2
answers
1468
gate 1987
In GATE 1987 question, order of $\Sigma$O(n)$ was found to be $O(n^2)$. Similarly, what will be the answer for order of $\Sigma$O(n^2)$ ? Will it be of $O(n^3)$ ? Thanks!
In GATE 1987 question, order of $\Sigma$$O(n)$ was found to be $O(n^2)$.Similarly, what will be the answer for order of $\Sigma$$O(n^2)$ ? Will it be of $O(n^3)$ ?Thanks...
someone
614
views
someone
asked
Jun 12, 2018
Algorithms
algorithms
asymptotic-notation
+
–
0
votes
0
answers
1469
Algo: Time Complexity
What is the time complexity of the following piece of code in the terms of n? $Main()$ { $n=2^{2^k};$ $for(i=1; i<=n; i++)$ { $j=2;$ $while(j<=n)$ { $j=j^2;$ } } }
What is the time complexity of the following piece of code in the terms of n?$Main()${$n=2^{2^k};$$for(i=1; i<=n; i++)${ $j=2;$ $while(j<=n)$ { $j=j^2;$ }}...
pbhati
346
views
pbhati
asked
Jun 12, 2018
Algorithms
algorithms
time-complexity
+
–
3
votes
1
answer
1470
Extended Master's Theorem $T(n)=n^{1/2}T(n^{1/2})+n$
Can Extended Masters theorem be applied to the following recursive equation ? $T(n)=n^{1/2}T(n^{1/2})+n$ I solved this using back substitution and the time complexity came out to be $O(n*(loglogn))$ I was wondering if this ... masters theorem, like the way Tauhin Gangwar has solved here - https://gateoverflow.in/60532/find-tc-t-n-2t-n-1-2-1
Can Extended Masters theorem be applied to the following recursive equation ?$T(n)=n^{1/2}T(n^{1/2})+n$I solved this using back substitution and the time complexity came ...
Hardik Maheshwari
3.7k
views
Hardik Maheshwari
asked
Jun 11, 2018
Algorithms
time-complexity
algorithms
master-theorem
asymptotic-notation
recurrence-relation
+
–
Page:
« prev
1
...
44
45
46
47
48
49
50
51
52
53
54
...
118
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register