51. Which application of stack is used to ensure that the pair of parentheses is properly nested?
52. What are the set of functions that are to be executed to get the following output?
cat
cat
53. What will be result if the given stack is popped?

54. What is the time complexity of the following code?
public boolean isBalanced(String exp)
{
int len = exp.length();
Stack<Integer> stk = new Stack<Integer>();
for(int i = 0; i < len; i++)
{
char ch = exp.charAt(i);
if (ch == '(')
stk.push(i);
else if (ch == ')')
{
if(stk.peek() == null)
{
return false;
}
stk.pop();
}
}
return true;
}
public boolean isBalanced(String exp)
{
int len = exp.length();
Stack<Integer> stk = new Stack<Integer>();
for(int i = 0; i < len; i++)
{
char ch = exp.charAt(i);
if (ch == '(')
stk.push(i);
else if (ch == ')')
{
if(stk.peek() == null)
{
return false;
}
stk.pop();
}
}
return true;
}
55. What data structure is used when converting an infix notation to prefix notation?
56. If the corresponding end bracket/braces/parentheses is encountered, which of the following is done?
57. Which is the most appropriate data structure for applying balancing of symbols algorithm?
58. What would be the Prefix notation for the given equation?
a|b&c
a|b&c
59. Out of the following operators (|, *, +, &, $), the one having lowest priority is . . . . . . . .
Read More Section(Stacks in Data Structures)
Each Section contains maximum 100 MCQs question on Stacks in Data Structures. To get more questions visit other sections.