25 votes 25 votes The most appropriate matching for the following pairs $$\begin{array}{|l|l|}\hline \text{X: depth first search} & \text{1: heap } \\\hline \text{Y: breadth first search} & \text{2: queue} \\\hline \text{Z: sorting} & \text{3: stack} \\\hline \end{array}$$ is: $\text{X - 1, Y - 2, Z - 3}$ $\text{X - 3, Y - 1, Z - 2}$ $\text{X - 3, Y - 2, Z - 1}$ $\text{X - 2, Y - 3, Z - 1}$ Algorithms gatecse-2000 algorithms easy graph-algorithm graph-search match-the-following + – Kathleen asked Sep 14, 2014 retagged Dec 16, 2023 by Hira Thakur Kathleen 5.4k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 24 votes 24 votes Answer is $C$. X - 3 DFS uses stack implicitly Y - 2 BFS uses queue explicitly in Algo Z - 1 Heap-Heapsort Akash Kanase answered Nov 23, 2015 edited Jun 12, 2018 by Milicevic3306 Akash Kanase comment Share Follow See all 3 Comments See all 3 3 Comments reply Angkit commented Mar 29, 2018 reply Follow Share What do you mean by the words "EXPLICIT" and "IMPLICIT" here? 1 votes 1 votes Sourav Basu commented Jul 14, 2018 reply Follow Share DFS algorithm directly does not use any stack but since it calls itself(recursion), recursion stack will be used by the OS 14 votes 14 votes Tanuj Arora commented Jun 3, 2023 reply Follow Share Iterative DFS algorithm is there too. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes DFS is done using the stack data structure BFS is done using the queue data structure Sorting is done using heap in heap sort X→ 3,Y→ 2 and Z→ 1 Corrcet answer will be option C. Psy Duck answered May 11, 2023 Psy Duck comment Share Follow See all 0 reply Please log in or register to add a comment.