Data Structures & AlgorithmsHardProduct-company placement
Lectures occupy half-open intervals [start, end): [2, 7), [6, 11), [8, 14), [9, 14), [10, 16), [13, 16), [13, 20), [14, 20). A lecture ending at t frees its room for one starting at t. What is the minimum number of rooms needed?
- A. 6
- B. 3
- C. 5
- D. 4
Correct answer: C. 5
Sweep the times, processing an end before a start at the same instant; the peak number of overlapping lectures is 5. Treating touching intervals as overlapping gives 6.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- A binary tree with distinct labels has INORDER D F I E A C H G B and LEVEL-ORDER D G C B E H F A I. What is its postorder traversal?
- A binary search tree holds exactly the keys 10, 17, 35, 59, 61, 68, 84, 91. Which ONE of the following sequences can be its PREORDER…
- DFS on the directed graph with adjacency lists A: BE; B: –; C: AD; D: AG; E: DF; F: D; G: E starts at A (scanning lists in the order…
- Keys 87, 36, 57, 23, 95, 88, 77 inserted in this order build a BST. How many of the 7! orderings of these same 7 keys, inserted into an…
- DFS runs on the directed graph with adjacency lists A: EF; B: A; C: A; D: AE; E: BCF; F: G; G: B, starting at A, scanning lists in the…
- A B-tree has minimum degree t = 4 (every non-root node has between 3 and 7 keys) and height 3 (a root-only tree has height 0). What are…