Question 11
EasyActivities (start, finish) are (1, 3), (2, 5), (4, 6), (6, 8) and (5, 9). How many non-overlapping activities can be chosen at most?
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Data Structures and Algorithms
Activities (start, finish) are (1, 3), (2, 5), (4, 6), (6, 8) and (5, 9). How many non-overlapping activities can be chosen at most?
2
3
5
4
Sign up free to see the answer and a step-by-step explanation.
Fractional knapsack with capacity 50 and items (value, weight) (60, 10), (100, 20), (120, 30). What is the best total value?
180
220
240
280
Sign up free to see the answer and a step-by-step explanation.
Dijkstra's shortest-path algorithm is an example of which approach?
Divide and conquer
Backtracking
Brute force
Greedy
Sign up free to see the answer and a step-by-step explanation.
Prim's minimum spanning tree algorithm is an example of which approach?
Greedy
Dynamic programming
Backtracking
Brute force
Sign up free to see the answer and a step-by-step explanation.
In job sequencing with deadlines, in what order are jobs considered?
In decreasing order of profit
In increasing order of profit
At random
By job name
Sign up free to see the answer and a step-by-step explanation.
In Huffman coding, which symbols get the shortest codes?
The symbols that come first in the alphabet
All symbols get equal-length codes
The most frequent symbols
The least frequent symbols
Sign up free to see the answer and a step-by-step explanation.
Does the greedy method always give the optimal answer?
No, it works only for problems with the right structure
Yes, always
Only for sorting
Only for graphs
Sign up free to see the answer and a step-by-step explanation.
Using coins of ₹1, ₹2, ₹5 and ₹10, what is the least number of coins that make ₹27?
3
4
6
5
Sign up free to see the answer and a step-by-step explanation.
Why are greedy algorithms usually fast?
They make one choice per step and never go back
They need no input
They use recursion only
They try every possibility
Sign up free to see the answer and a step-by-step explanation.
To connect ropes into one with the least total cost (joining two ropes costs their total length), which ropes should be joined first?
Any two ropes
The longest and the shortest
The two longest ropes
The two shortest ropes
Sign up free to see the answer and a step-by-step explanation.