Multiple choice

The balance of parenthesis in an arithmetic expression can be best checked with which of the following data structures?

  1. Queue

  2. Stack

  3. Tree

  4. Heap

  5. List

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

A stack is a particular kind of abstract data type or collection in which the principal (or only) operations on the collection are the addition of an entity to the collection, known as push and removal of an entity, known as pop. The relation between the push and pop operations is such that the stack is a Last-In-First-Out (LIFO) data structure. It is the best data for checking the balancing of parenthesis.