Check for Balanced Parentheses using Stack?



Check for Balanced Parentheses using Stack?..

Answer / hrpynux@gmail.com

If the current character is a starting bracket ('(' or '{' or '[') then push it to stack. If the current character is a closing bracket (')' or '}' or ']') then pop from stack and if the popped character is the matching starting bracket then fine else brackets are not balanced.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

Explain 'this' pointer and what would happen if a pointer is deleted twice?

0 Answers   Genpact,


what is polymorphism?

14 Answers   Accenture,


What is type of 'this' pointer? Explain when it is get created?

0 Answers  


What is c++ hiding?

0 Answers  


What is a node class?

1 Answers  






What is the best c++ compiler?

0 Answers  


What is lvalue?

0 Answers  


What is const pointer and const reference?

0 Answers  


When does a name clash occur in c++?

0 Answers  


Why is it necessary to use a reference in the argument to the copy constructor?

0 Answers  


How to avoid changing constant values?

2 Answers   Symphony,


Write a function to perform the substraction of two numbers. Eg: char N1="123", N2="478", N3=-355(N1-N2).

0 Answers  


Categories