Recent questions tagged algorithms

2 2 votes
3 3 answers
450
450 views
Consider two DNA sequences represented by strings $S_1=$ "AGGTAB" and $S_2=$ "GXTXAYB". To analyse their relationship, a bioinformatician wants to find the shortest possi...
3 3 votes
3 3 answers
492
492 views
The five items, A, B, C, D, and E, are pushed in a stack, one after the other, starting from A. The stack is popped four times and each element is inserted in a queue. Th...
2 2 votes
2 2 answers
344
344 views
Consider the following binary search tree T given below. Which node contains the fourth smallest element in $T$ ?Q V W X
3 3 votes
3 3 answers
451
451 views
If one uses the straight two-way merge sort algorithm to sort the following elements in ascending order: $20,47,15,8,9,4,40,30,12,17$, then the order of these elements af...
3 3 votes
3 3 answers
597
597 views
A file contains the following characters with the given frequencies:a: $45$b: $13$c: $12$d: $16$e: $9$f: $5$What is the total number of bits required to encode the messag...
3 3 votes
3 3 answers
455
455 views
Consider the following weighted, directed graph. If Dijkstra's single-source shortest path algorithm is run with source vertex 'S', what is the order in which the vertice...
2 2 votes
2 2 answers
398
398 views
Consider a connected, undirected graph $G=(V, E)$ with a weight function $w: E \rightarrow \mathbb{R}^{+}$ where all edge weights are distinct. Let $T$ be the Minimum Spa...
3 3 votes
3 3 answers
473
473 views
Consider the following recurrence:$$\begin{aligned}& T(n)=2 T(\sqrt{n})+1 \\& T(1)=1\end{aligned}$$Which of the following is NOT true?$T(n)=O(\log \log n)$ $T(n)=O(\log n...
3 3 votes
2 2 answers
367
367 views
The recurrence relation that arises in relation with the complexity of binary search is$T(n)=2 T(n / 2)+k$, where k is constant $T(n)=T(n / 2)+k$, where k is constant $T(...
1 1 vote
4 4 answers
470
470 views
Arrange the following recurrence relations in increasing order of their time capacity.(A) $\mathrm{T}(\mathrm{n})=\mathrm{T}(\mathrm{n} / 2)+1$(B) $\mathrm{T}(\mathrm{n})...
2 2 votes
3 3 answers
508
508 views
Which of the following is not time complexity of the following code:(O represents big-oh) for (i=1 to n): // Some constant time operation,O(1) // Then a loop that runs lo...
2 2 votes
2 2 answers
431
431 views
If the array $A$ contains elements $25,40,23,7,54,78$ and $2$ in that order, The element at $3^{\text {rd }}$ position of the array after $3^{\text {rd }}$ pass of insert...
1 1 vote
2 2 answers
448
448 views
G is an undirected graph with vertex set ( $\mathrm{v} 1, \mathrm{v} 2, \mathrm{v3}, \mathrm{v4}, \mathrm{v5}, \mathrm{v6}, \mathrm{v7}$ ) and edge set [ $\mathrm{v} 1 \m...
2 2 votes
2 2 answers
310
310 views
A Huffman tree is constructed for the following data: $[A, B, C, D, E]$ with frequency $\{0.17$, $0.11,0.24,0.33$ and $0.15$} respectively. $1000001101$ is decoded asBACE...
0 0 votes
1 1 answer
317
317 views
How to check if f(n) is polynomially greater than g(n)?
0 0 votes
1 1 answer
388
388 views
Which of the following technique is used for Clipping?Stack based SeedScan Line SeedSutherland-CohenInverse Scaling
2 2 votes
1 1 answer
398
398 views
Match List I with List II$\begin{array}{|ll|ll|} \hline & \textbf{List I} & & \textbf{List II} \\ \hline \text{A.} & \text{Circular Queue} & \text{I.} & \text{Print Queue...
0 0 votes
0 0 answers
324
324 views
Consider the following Graph of disk scheduling and identify the disk scheduling algorithm representing by this graph.Queue $84, 125, 11, 36, 170, 20, 172, 45$$\text{SSTF...
0 0 votes
1 1 answer
425
425 views
Which of the following algorithms are based on the Breadth First Search (BFS) ?Prim's algorithmsKruskal algorithmsDijkstra algorithmsGreedy algorithmsDynamic ProgrammingC...
0 0 votes
3 3 answers
422
422 views
Let T(n) = 2T(n/2) + O(n), Where "O" is big-oh . What will be asymptotic notation on T(n)?options are MSQa).Theta(n)b).Theta(nlogn)c).Theta(n^2)d).O(n^3)
0 0 votes
1 1 answer
347
347 views
Match List - I with List - II.$\begin{array}{|ll|ll|} \hline & \textbf{List - I} & & \text{List - II} \\ \hline & \textbf{(Algorithms)} & & \textbf{(Characteristics)} \\ ...
4 4 votes
3 3 answers
632
632 views
Consider the weights and values of items listed below. Note that there is only one unit of each item.\[\begin{array}{|l|c|c|}\hline\text{Item number} & \text{Weight (in K...
3 3 votes
2 2 answers
378
378 views
We are given 8 tasks $T_1, T_2, \ldots, T_8$. The execution of each task requires one unit of time. We can execute one task at a time. Each task $T_i$ has a profit $P_i$ ...
2 2 votes
2 2 answers
382
382 views
Consider the following functions:$$\begin{aligned}& \mathrm{f}(\mathrm{n})=3 \mathrm{n}^{\sqrt{\mathrm{n}}} \\& \mathrm{~g}(\mathrm{n})=2^{\sqrt{\mathrm{n}}\log _2{\mathr...
2 2 votes
2 2 answers
343
343 views
If algorithm $A$ and another algorithm $B$ take $\log _2(n)$ and $\sqrt{ } n$ microseconds, respectively, to solve a problem, then the largest size $n$ of a problem these...
1 1 vote
2 2 answers
456
456 views
Given a 2-D array mat where the elements of each row are sorted in non-decreasing order and the first element of a row is greater than the last element of the previous ro...
0 0 votes
0 0 answers
217
217 views
In the content of Alpha Beta pruning in game trees which of the following statements are correct regarding cut off procedures ?Alpha Beta pruning can eliminate subtrees w...
1 1 vote
1 1 answer
418
418 views
We have an array $A$ of $n$ numbers, where $n$ is a power of $2$.We build a full binary tree on top of the array $A.$ The elements of the array are leaves of the tree, nu...
1 1 vote
1 1 answer
317
317 views
We have an array $A$ of $n$ numbers, where $n$ is a power of $2$.We build a full binary tree on top of the array $A.$ The elements of the array are leaves of the tree, nu...
1 1 vote
4 4 answers
589
589 views
You are given two sorted arrays, each of length $n$. What is the best possible time complexity (in the worst case) to find the median of the combined $2 n$ elements?$O(n)...