Home »
MCQs »
Data Structure and Algorithms (DSA) MCQs
Which of the following data structures can be used to check if an expression has matching parenthesis or not?
21. Which of the following data structures can be used to check if an expression has matching parenthesis or not?
- Tree
- Queue
- Stack
- Linkedlist
Answer
The correct answer is: C) Stack
Explanation
Stack. As stack is using the LIFO (Last In First Out) approach, it is best suited to find matching parenthesis.