Hi guys, i recieved a question for homework. I dont really understand what its asking me to do.
Question:
Code:
bool balanced(vector <char> p)
// Precondition: p[0]...p[n-1] contains n characters, each of which
// is ’(’, ’)’, ’{’ or ’}’.
// Postcondition: The function returns true if the characters form a
// sequence of correctly balanced parentheses with each ’(’ matching
// a ’)’ and each ’{’ matching a ’}’. Note that a sequence such as
// ( { ) } is NOT balanced because when we draw lines to match the
// parentheses to their partners, the lines cross each other. On the
// other hand, ( { } ) amd { ( ) } are both balanced.
if someone can explain what its trying to ask for, that would be much appreciated.
PS. im not asking someone to do it for me, just explain what its trying to say cheers