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 the C++

1 Answers   Wipro,


What is srand c++?

0 Answers  


What is the use of bit fields in structure declaration?

0 Answers  


What language does google use?

0 Answers  


How are Structure passing and returning implemented by the compiler?

0 Answers  






what is oops and list its features in c++?

0 Answers  


What do you mean by inheritance in c++?

0 Answers  


What are vtable and vptr?

0 Answers  


const char * char * const What is the differnce between the above two?

11 Answers   TCS,


Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. Your program should work for squares of all side sizes between 1 and 20. --- │ │ │ │ │ │ ---

0 Answers  


What is c++ try block?

0 Answers  


Write about the local class and mention its use?

0 Answers  


Categories