Greedy Technique


Q11.

Suppose the letters a, b, c, d, e, f have probabilities 1/2, 1/4, 1/8, 1/16, 1/32, 1/32 respectively. Which of the following is the Huffman code for the letter a, b, c, d, e, f?
GateOverflow

Q12.

We are given 9 tasks T1, T2... T9. The execution of each task requires one unit of time. We can execute one task at a time. Each task Ti has a profit Pi and a deadline di Profit Pi is earned if the task is completed before the end of the dith unit of time. Are all tasks completed in the schedule that gives maximum profit?
GateOverflow

Q13.

The characters a to h have the set of frequencies based on the first 8 Fibonacci numbers as follows a:1, b:1, c:2, d:3, e:5, f:8, g:13, h:21 A Huffman code is used to represent the characters. What is the sequence of characters corresponding to the following code? 110111100111010
GateOverflow

Q14.

We are given 9 tasks T1, T2... T9. The execution of each task requires one unit of time. We can execute one task at a time. Each task Ti has a profit Pi and a deadline di Profit Pi is earned if the task is completed before the end of the dith unit of time. What is the maximum profit earned?
GateOverflow

Q15.

Suppose the letters a, b, c, d, e, f have probabilities 1/2, 1/4, 1/8, 1/16, 1/32, 1/32 respectively. What is the average length of the Huffman code for the letters a,b,c,d,e,f?
GateOverflow

Q16.

In the following table, the left column contains the names of standard graph algorithms and the right column contains the time complexities of the algorithms. Match each algorithm with its time complexity. \begin{array}{|ll|ll|}\hline \text{1.} & \text{Bellman-Ford algorithm} & \text{A:} & \text{$O(m\log n)$} \\\hline \text{2.} & \text{Kruskal's algorithm} & \text{B:}& \text{$O(n^3)$} \\\hline \text{3.}& \text{Floyd-Warshall algorithm} & \text{C:} & \text{$O(nm)$} \\\hline \text{4.} & \text{Topological sorting} &\text{D:} & \text{$O(n+m)$} \\\hline \end{array}
GateOverflow