Recent questions tagged greedy-algorithms

3 3 votes
2 answers 2 answers
979
979 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...
4 4 votes
1 answers 1 answer
828
828 views
Consider a sorted array of $p$ numbers. What would be the time complexity of the best known algorithm to find a pair $x$ and $y$ such that $\left | x-y \right |$ $=$ $m$ ...
0 0 votes
0 0 answers
3.1k
3.1k views
Given n activities with their start and finish times.Select d mad no of activities dat can be performed by a single​ person assuming tat a person can only work on a singl...
0 0 votes
1 answers 1 answer
5.3k
5.3k views
Consider the following instance of the knapsack problem: n=3 , W=50 , (v1,v2,v3) = (60,100,120) and weight (w1,w2,w3) = (10,20,30) .solve the given knapsack problem apply...
1 1 vote
1 answers 1 answer
3.3k
3.3k views
$\begin{bmatrix} 0& 29& 19& 25& 22\\ 20& 0& 21& 23& 21\\ 19& 21& 0& 21& 20\\ 25& 23& 21& 0& 32\\ 22& 21& 20& 22& 0 \end{bmatrix}$Find the shortest tour for given graph us...
1 1 vote
1 answers 1 answer
15.6k
15.6k views
Consider the Knapsack incidence with n=3(items) with weights {w1,w2,w3}={2,3,4} and profits are {p1,p2,p3}={1,2,5}Given the capacity is 5,{W/M = 5 } Find the optimal solu...
4 4 votes
3 answers 3 answers
2.1k
2.1k views
US portal Denominations are 1,10,21,34,70 , 100 and 350 . A) Make 140 Cents .Verify whether Greedy choice fails or notB) Make 182 Cents.Verify whether greedy choice fails...
4 4 votes
1 answers 1 answer
1.7k
1.7k views
Consider the following set of messages with their frequencies: $$\begin{array}{|c|c|c|} \hline \textbf{Message} & \textbf{Frequency} \\ \hline A & 50\: \text{million} \...
2 2 votes
4 4 answers
6.0k
6.0k views
The optimal time required in merging the list of size 11, 21, 33, 34,45,54,60 ismy answer (11+21)*4+ 33*3 +(34+45)*3 + (54+60)*2but the provided answer is 269 to 282I don...
6 6 votes
2 answers 2 answers
2.6k
2.6k views
3 3 votes
3 3 answers
15.5k
15.5k views
i know time complexity is O(nlogn) but can upper bound given in question consider as TRUE..
2 2 votes
2 2 answers
1.1k
1.1k views
0 0 votes
1 1 answer
796
796 views
Suppose letters a,b,c,d,e,f have probabilities ½, ¼, 1/8, 1/16, 1/32, 1/32. Which of the following is the Huffman code for the letters a,b,c,d,e,f.0, 10, 110, 1110, 11110...
33 33 votes
5 answers 5 answers
9.3k
9.3k views
We are given $9$ tasks $T_1, T_2, \dots, T_9$. 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
3 answers 3 answers
1.4k
1.4k views
Suppose we have a graph with a negative weight cycle reaching from the source. And if we try to compute shortest path using Dijkstra's algorithm which of the following is...
1 1 vote
1 1 answer
836
836 views
what is the difference between fractional knapsack and 0-1 problem . pl explain concepts with simple problems
0 0 votes
1 answers 1 answer
2.6k
2.6k views
Find out maximum profit for fractional knapsack with maximum allowable weight $=14$ and $n=5$\[\left(\mathrm{P}_{1}, \mathrm{P}_{2}, \mathrm{P}_{3}, \mathrm{P}_{4}, \math...
2 2 votes
2 answers 2 answers
8.3k
8.3k views
Given the symbols A, B, C, D, E, F, G and H with the probabilities $\frac{1}{30}, \frac{1}{30}, \frac{1}{30}, \frac{2}{30}, \frac{3}{30}, \frac{5}{30}, \frac{5}{30}$ and ...
1 1 vote
2 answers 2 answers
846
846 views
I think Dijkstra algo. works fine with negative weight in connected graphs but not with negative cycle..if we have -ve weight but no cycle then it will give the shortest ...
1 1 vote
1 1 answer
652
652 views
If a graph contains a positive weight cycle reachable from source, Can we find a well defined shortest path using Dijkstra/Bellman-Ford algorithm?
1 1 vote
1 1 answer
611
611 views
Can we find Negative weight cycles reachable from source in a graph using Dijkstra's Algorithm??
1 1 vote
2 2 answers
9.0k
9.0k views
Consider the fractional knapsack instance$n = 4, (p_{1} , p_{2} , p_{3} , p_{4} ) = (10, 10, 12, 18), (w_{1} , w_{2} , w_{3} , w_{4} ) = (2, 4, 6, 9)$ and $M = 15$.The ma...
16 16 votes
2 answers 2 answers
3.1k
3.1k views
You are given $n$ positive integers, $d_1, d_2 \dots d_n$, each greater than $0$. Design a greedy algorithm to test whether these integers correspond to the degrees of so...
49 49 votes
3 answers 3 answers
23.4k
23.4k views
Suppose the letters $a, \,b, \,c, \,d, \,e, \,f$ have probabilities $\dfrac{1}{2}, \dfrac{1}{4}, \dfrac{1}{8}, \dfrac{1}{16}, \dfrac{1}{32}, \dfrac{1}{32}$, respectively....
0 0 votes
1 answers 1 answer
757
757 views
Let $F_1,F_2,..............F_n$ be files with length $L_1,L_2........L_n$ we would like to merge all of the files together to make a single file .The cost of merging file...
2 2 votes
2 answers 2 answers
3.8k
3.8k views
There are n white dots and n black dots. Equally spaced in a line. You want to connect each white dot with some block dot in one to one fashion with a minimum total lengt...
0 0 votes
2 2 answers
2.2k
2.2k views
A set of ' $n$ ' jobs is given. Associated with job $i$ is an integer deadline $d_{1} \geq 0$ and a profit $P_{i}>0$ and each job need to be executed for one unit of time...
5 5 votes
1 answers 1 answer
2.8k
2.8k views
In Optimal merge pattern when do we get more than one tree(Sub trees) when creating a merge pattern?Can you explain/draw optimal merge tree for n=7, <8,15,3,10,20,2,30>
6 6 votes
3 3 answers
28.6k
28.6k views
What is the time complexity of job sequencing with deadline using greedy algorithm?O(n)O(log n)O(n log n)O(n2)Made EasyFull Syllabus Test-6 : Basic Level : Practice Test-...
1 1 vote
1 1 answer
616
616 views
hi all ,Please tell me how much does dijkastra algoritm would take for unwaited and martix implementation