Recent questions tagged tbb-algorithms-2

0 0 votes
1 1 answer
939
939 views
The cost of optimal binary search tree for the identifier set $(a1, a2, a3) =$ (do, if, while) with $p(1) = 0.3, \ p(2) = 0.2, $ $p(3) = 0.15, q (0) = 0.05, q(1) = 0.15...
2 2 votes
1 answers 1 answer
1.2k
1.2k views
The given input sequence is $\{ 111, 333 , 243, 199, 234, 279, 119 \}$ and the hash table is of size $10$ with hash function $h(k) = k \mod 10$. When hash table uses quad...
2 2 votes
2 answers 2 answers
792
792 views
Assume Dijkstra's Algorithm is used to find the shortest paths from node G in the above graph. The total number of edges which are not included in any of the shortest pat...
1 1 vote
2 answers 2 answers
990
990 views
The total number of LCS (Longest Common Subsequences) of $P = abcd123$ and $Q= badc321$ that can be formed are ______.
0 0 votes
1 answers 1 answer
727
727 views
Consider the following instance of the knapsack problem :$\begin{array}{|c|c|c|c|c|c|} \hline \text{Item} & a & b & c & d & e \\ \hline \text{Benefit} & 15 & 12 & 9 & 16 ...
0 0 votes
2 answers 2 answers
641
641 views
Let $T$ be a rooted ternary tree where each internal node of $T$ has a maximum of $3$ children. If root is at depth $0$, then maximum total number of vertices $T$ can hav...
0 0 votes
3 answers 3 answers
1.9k
1.9k views
Given $n$ number of linearly ordered distinct elements, what will be the worst case time complexity to find$p$-th smallest element $(1 \leq p \leq n)$ from these $n$ elem...
0 0 votes
2 answers 2 answers
1.3k
1.3k views
Matrix multiplication is associative and MCS ( matrix chain multiplication ) uses the following matrices:$\begin{array} \text{M1} & 10^* 100 \\ M2 & 100^* 5 \\ M3 & 5^* ...
0 0 votes
1 answers 1 answer
540
540 views
Consider the following table :$\begin{array}{|c|c|c|c|c|} \hline X & A & B & C & D \\ \hline Y & 14 & 3 & 6 & 10 \\ \hline \end{array}$Here, X represents character and Y ...
1 1 vote
1 answers 1 answer
506
506 views
The number of comparisons required to find the maximum and minimum element in an array $A[n]$ using Divide and Conquer method is:$(3n/2)+ 2$$(3n/2) - 2$$3n$$3n/2$
2 2 votes
1 answers 1 answer
837
837 views
Consider the following Graph G: The number of minimum cost spanning trees using Kruskal's Algorithm is _________ .
0 0 votes
1 answers 1 answer
760
760 views
A hash table of length $7$ uses open addressing with hash function $h(k) = k \text{mod }7$ and linear probing to resolve collisions.After inserting 6 values in an empty h...
0 0 votes
3 answers 3 answers
1.0k
1.0k views
The following elements are inserted in sequence to create an AVL tree: $31, 36, 40, 19, 14, 24, 50$What is the pre-order traversal of the created AVL tree?$36, 19, 14, 31...
2 2 votes
1 answers 1 answer
897
897 views
Which of the following are TRUE?$n! = \theta ((n + 1)!)$$\log4 n = \theta ( \log2 n )$$\sqrt{\log n} = O(\log \log n)$(i) & (iii) only(i) & (ii) only(ii) only(i),(ii) ...
0 0 votes
1 answers 1 answer
942
942 views
Consider the following max-heap as given below : 9 / \ 6 8 / \ / \3 4 5 7The number of swaps required to convert the given max-hea...
0 0 votes
2 answers 2 answers
778
778 views
The length of the longest common subsequence of $L = ( 1,0,0,1,0,1,0,1 )$ and $K =( 0,1,0,1,1,0,1,1,0 )$ is __________.
3 3 votes
2 answers 2 answers
958
958 views
Match the following:$\begin{array}{|l|l|l|l|} \hline (1) & \text{Multistage graph} & (P) & \text{Divide and conquer}\\ \hline (2) & \text{Convex hull } & (Q) & \text{Dept...
2 2 votes
2 answers 2 answers
595
595 views
Which one of the following is a topological sort for the above graph?$1, 6, 2, 5, 3, 4$$4, 5, 6, 3, 2, 1$$2, 4, 5, 6, 3, 1$$6, 4, 5, 2, 1, 3$
1 1 vote
1 answers 1 answer
527
527 views
The time complexity of the function mentioned below is:void f(int k[], int n) { int i; printf("%d",n); for(i=0; i<n; i++) { printf("%d",k[i]); } printf("n"); }$O(n^2)$$O(...
1 1 vote
1 answers 1 answer
521
521 views
Let the node P be the starting vertex for Prim's Algorithm as given in the diagram below:In order to construct the Minimum Spanning Tree, which of the following options r...
1 1 vote
2 answers 2 answers
780
780 views
In Strassen's Matrix Multiplication, what is the number of additions and multiplications done to get a better complexity than the normal matrix multiplication?$7$ and $16...
1 1 vote
1 1 answer
516
516 views
Linked Lists are not suitable for :Binary SearchPolynomial ManipulationInsertionRadix Sort
1 1 vote
1 answers 1 answer
728
728 views
Assume that the splits at every level of Quick-Sort are in proportion $1-p$ to $p$, where $p (0 < p \leq 0.5 )$ is a constant. The number of elements in an array is $n$....
0 0 votes
2 answers 2 answers
1.3k
1.3k views
$O(n^k)$ is complexity of the best method that finds longest Palindrome Substring in a word. For example, in the word "Atatb", the longest palindrome string is "tat". The...
0 0 votes
2 2 answers
565
565 views
Which of the following statements is FALSE?Optimal binary search tree construction can be performed efficiently using dynamic programming.Breadth-first search cannot be u...
0 0 votes
1 answers 1 answer
1.2k
1.2k views
A problem called Boolean Parenthesis Matching (match all parenthesis in an expression) can be solved by:Greedy ApproachRecursionDynamic ApproachBoth [B] and [C]
0 0 votes
2 answers 2 answers
1.9k
1.9k views
What will be the running-time of Dijkstra's single source shortest path algorithm, if the graph $G(V,E)$ is stored in the form of an adjacency list and binary heap is use...
0 0 votes
3 answers 3 answers
2.7k
2.7k views
Find the time complexity of the functionfunction( int n) { int i=1; while( i<n) { int j=n; while( j>0) j=j/2; i=2*i; } }$O(\log n)$$O(n^2 \log n )$$O(\log 2 n)$$O( \log n...
0 0 votes
1 answers 1 answer
1.2k
1.2k views
Which of the following algorithms CANNOT be designed without recursion?Tower of HanoiFibonacci SeriesTree TraversalNone of the above
1 1 vote
2 answers 2 answers
1.1k
1.1k views
Which of the following theorems can solve all Recurrence Relations?Mater TehoremAkra-Bazzi TheoremBoth [A] and [B]Akra-Bazzi can be applied to some cases but not for all.
To see more, click for the full list of questions or popular tags.