Stacks & Queues


Your answer
Answer & solution
Answer: C: X3,Y2,Z1 (no official key was published)
Step 1: DFS must return to the latest unfinished branch, a last-in-first-out behavior implemented by an explicit stack or recursive call stack. Thus X→3.
Step 2: BFS processes older discovered vertices first, using a FIFO queue, so Y→2. A heap supports repeated minimum/maximum extraction for sorting, so Z→1.
Together these matches give C. The sorting match refers to heap sort, not to every possible sorting algorithm.