# Uttrakhand Asst. Professor Exam-19

110 views

Which of the following search method takes less memory ?

1.  Depth-first search
3.  Linear search
4.  None of the above

edited

DFS or Depth-First Search takes less memory than BFS and Linear Search.

BFS uses a queue, which contains nodes at the front of the search. So at most all nodes at distance d.

whereas, DFS uses a stack, which contains nodes from root to the node being searched. So at most the radius of the graph.

If we consider a balanced k-ary tree and the depth of the tree is $O(log(n))$ and at the lowest level there are $O(n)$ nodes , then

DFS uses $O(log(n))$ memory while BFS uses $O(n)$ memory.

edited

## Related questions

1 vote
1
90 views
Which of the following problem cannot be solved without recursion? Tower of Hanoi Fibonacci series Tree Traversal None of the above
If the post order traversal of tree gives $ab - cd * +$, then the label of the nodes A, B, C, ......, G will be a, -, b, +, c, *, d +, -, *, a, b, c, d -, a, +, b, c, d, * a, b, c, d, -, *, +