For which of the following tasks, stack is not a suitable data structure? (A)…

2018

For which of the following tasks, stack is not a suitable data structure? (A) Binary search in an array (B) Breadth first search (C) Implementing function calls (D) Process scheduling

  1. A.

    (B) and (D)

  2. B.

    (B) and (C)

  3. C.

    (A) and (C)

  4. D.

    (C) and (D)

Attempted by 691 students.

Show answer & explanation

Correct answer: A

Answer: Breadth First Search and Process scheduling are not suitable for a stack.

  • Breadth First Search requires FIFO behavior and is implemented with a queue; using a stack would produce a depth-first exploration instead.

  • Process scheduling is usually managed by a ready queue (or other queue-based structures like priority queues), so a stack is not appropriate for typical scheduling policies.

  • Function calls are implemented using a call stack: activation records, return addresses, and local state are pushed and popped, so a stack is the correct structure for function calls.

  • Binary search can be implemented iteratively (no stack needed) or recursively (which uses the system call stack). In either case, binary search is not an example that rules out the stack as a suitable structure.

Conclusion: Stack is not suitable for Breadth First Search and Process scheduling; it is suitable for implementing function calls, and binary search does not require rejecting the stack.

Explore the full course: Up Lt Grade Assistant Teacher 2025