Recent questions tagged algorithms

3 votes
1 answer
2611
Maximum element in a min-heap represented by an array, can be computed in _____ time$O(n)$$O(\log n)$$O(n \log n)$ but not $O(n)$$O(1)$
2 votes
2 answers
2613
About how many compares will Quicksort() make when sorting an array of N items that are all equal?$\Theta(\lg N)$$\Theta(N\lg N)$$\Theta(\lg \lg N)$$\Theta(N/\lg N)$
2 votes
4 answers
2617
Is an array that is sorted in decreasing order a max-heap?always yesalways nosometimes onlyyes but not in presence of duplicates
2 votes
1 answer
2619
3 votes
1 answer
2621
2 votes
1 answer
2624
3 votes
2 answers
2628
4 votes
2 answers
2629
For the following program fragment, the running time is given byProcedure A(n) { if(n <= 2) return 1; else return A(log (n)); }$\Theta(\log \log n)$$\Theta(\log \sqrt n)$...
1 votes
1 answer
2630
Match the following :$\begin{array}{clcl} \text{a.} & \text{Prim’s algorithm} & \text{i.} & \text{$O(V^2E)$} \\ \text{b.} & \text{Bellman-Ford algorithm} & \text{ii.} ...
2 votes
2 answers
2635
#include <stdio.h int main() { int x,y = 0; //assume a[] as any array. for(x = 0; x < n; ++x) { while(y < n && arr[x] < arr[y]) y++; } return 0; }
0 votes
1 answer
2640
Insertion Sorts complexity is O(n+d) where d is no. of inversions.(There are some questions in gate where no. of inversions are given in terms of n.)I am unable to Under...