Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  For which of the following tasks, stack is no... Start Learning for Free
For which of the following tasks, stack is not suitable data structure?
(a) Binary search in an array
(b) Breadth first search
(c) Implementing function calls
(d) Process scheduling
  • a)
    (b) and (d)
  • b)
    (b) and (c)
  • c)
    (a) and (c)
  • d)
    (c) and (d)
Correct answer is option 'A'. Can you explain this answer?
Most Upvoted Answer
For which of the following tasks, stack is not suitable data structure...
Concept:
Stack is a data structure in which elements can be inserted and deleted only from one end i.e. top of the stack. It follows the LIFO property i.e. last in first out.
Explanation:
(a) Binary search in an array

Binary search in an array can be performed with the help of stack.  Binary search works on the divide and conquer approach and finds the middle element and then perform the search in the left side if element is smaller than the middle element otherwise search proceed in the right of middle element.
(b) Breadth first search
Breadth first search is graph traversal algorithm. It uses queue data structure to traverse the graph or the tree. It is also used to find the connected components in a graph.
(c) Implementing function calls
Function calls are implemented using the stack data structure. As, when a function call arrives then the state or the data currently operated on is stored on the stack where it is resumed after the execution of function call.
(d) Process scheduling
Process scheduling is implemented using the queue data structure . Ready queue is maintained for the processes which are ready for the execution.
Free Test
Community Answer
For which of the following tasks, stack is not suitable data structure...
Explanation:
A stack is a data structure that follows the Last-In-First-Out (LIFO) principle, meaning that the last element added to the stack is the first one to be removed. It is suitable for certain tasks, but not for others. Let's analyze each option and determine whether a stack is suitable for the task or not.

(a) Binary search in an array:
A binary search is a search algorithm that divides a sorted array into two halves and repeatedly compares the middle element with the target value. Since a binary search requires accessing elements in the middle of the array, a stack is not suitable for this task. Instead, a binary search typically uses a divide-and-conquer approach, which involves accessing elements directly through indexing.

(b) Breadth first search:
Breadth first search (BFS) is a graph traversal algorithm that explores all the vertices of a graph in breadth-first order. In BFS, we need to visit all the neighbors of a vertex before moving on to the next level. A queue is typically used to implement BFS, not a stack. Therefore, a stack is not suitable for implementing BFS.

(c) Implementing function calls:
When a function is called, the current state of the program, including variables and the return address, is stored on a stack. This allows the program to return to the previous state after the function call is completed. Therefore, a stack is suitable for implementing function calls.

(d) Process scheduling:
Process scheduling involves managing the execution of multiple processes in a computer system. It determines which process should run next based on various scheduling algorithms. While a stack could potentially be used to track the order of processes, it is not the most suitable data structure for this task. Other data structures, such as queues or priority queues, are typically used for process scheduling.

Conclusion:
Based on the analysis above, a stack is not suitable for tasks involving binary search in an array and breadth first search. Therefore, option (a) is the correct answer.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

For which of the following tasks, stack is not suitable data structure?(a) Binary search in an array(b) Breadth first search(c) Implementing function calls(d) Process schedulinga)(b) and (d)b)(b) and (c)c)(a) and (c)d)(c) and (d)Correct answer is option 'A'. Can you explain this answer?
Question Description
For which of the following tasks, stack is not suitable data structure?(a) Binary search in an array(b) Breadth first search(c) Implementing function calls(d) Process schedulinga)(b) and (d)b)(b) and (c)c)(a) and (c)d)(c) and (d)Correct answer is option 'A'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about For which of the following tasks, stack is not suitable data structure?(a) Binary search in an array(b) Breadth first search(c) Implementing function calls(d) Process schedulinga)(b) and (d)b)(b) and (c)c)(a) and (c)d)(c) and (d)Correct answer is option 'A'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for For which of the following tasks, stack is not suitable data structure?(a) Binary search in an array(b) Breadth first search(c) Implementing function calls(d) Process schedulinga)(b) and (d)b)(b) and (c)c)(a) and (c)d)(c) and (d)Correct answer is option 'A'. Can you explain this answer?.
Solutions for For which of the following tasks, stack is not suitable data structure?(a) Binary search in an array(b) Breadth first search(c) Implementing function calls(d) Process schedulinga)(b) and (d)b)(b) and (c)c)(a) and (c)d)(c) and (d)Correct answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of For which of the following tasks, stack is not suitable data structure?(a) Binary search in an array(b) Breadth first search(c) Implementing function calls(d) Process schedulinga)(b) and (d)b)(b) and (c)c)(a) and (c)d)(c) and (d)Correct answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of For which of the following tasks, stack is not suitable data structure?(a) Binary search in an array(b) Breadth first search(c) Implementing function calls(d) Process schedulinga)(b) and (d)b)(b) and (c)c)(a) and (c)d)(c) and (d)Correct answer is option 'A'. Can you explain this answer?, a detailed solution for For which of the following tasks, stack is not suitable data structure?(a) Binary search in an array(b) Breadth first search(c) Implementing function calls(d) Process schedulinga)(b) and (d)b)(b) and (c)c)(a) and (c)d)(c) and (d)Correct answer is option 'A'. Can you explain this answer? has been provided alongside types of For which of the following tasks, stack is not suitable data structure?(a) Binary search in an array(b) Breadth first search(c) Implementing function calls(d) Process schedulinga)(b) and (d)b)(b) and (c)c)(a) and (c)d)(c) and (d)Correct answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice For which of the following tasks, stack is not suitable data structure?(a) Binary search in an array(b) Breadth first search(c) Implementing function calls(d) Process schedulinga)(b) and (d)b)(b) and (c)c)(a) and (c)d)(c) and (d)Correct answer is option 'A'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev