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

What is an object in c++?

0 Answers  


What is the difference between the functions memmove() and memcpy()?

0 Answers  


What does the ios::ate argument do?

0 Answers  


Why do we need templates?

0 Answers  


What is implicit pointer in c++?

0 Answers  






which operator is used for performing an exponential operation a) > b) ^ c) none

0 Answers  


why we cant create array of refrences

4 Answers  


Explain rtti.

0 Answers  


Can a class be static in c++?

0 Answers  


Write about the retrieval of n number of objects during the process of delete[]p?

0 Answers  


Explain the concept of dynamic allocation of memory?

0 Answers  


Explain the differences between private, public and protected and give examples.

0 Answers  


Categories