@shady: I guess first mismatch means the innermost open brace that doesnt have a close brace. U cannot know that the first brace does not have a closing one unless u look at the entire string.
On Tue, Dec 20, 2011 at 9:23 AM, shady <[email protected]> wrote: > ( ( ) ( ( ) ( ( ) ) ( ) for this SAMM faulty index is 0, because the > first bracket has itself found no matching.... > > @atul > ( ( ( () ) ) for this first bracket is faulty as it couldn't find a > closing bracket, , , > you can keep a stack with map as element > stack< map<int, char> > > > map<int, char> where integer is the index of the bracket, which is stored > as char > idea is similar to don's. > > > On Tue, Dec 20, 2011 at 10:42 PM, atul anand <[email protected]>wrote: > >> there are multiple mismatch or only one mis-match in the input string. >> >> if the given string as below :- >> >> ( ( ( () ) ) -> for this is missing match is for 1st , 2nd or 3rd >> bracket. >> >> what would be the answer for this. >> >> On Tue, Dec 20, 2011 at 8:10 PM, zeroByZero <[email protected]>wrote: >> >>> In a given string arrary arr[] = "((()())" or any other string return >>> index for which no match is found as for this example is index 0 and >>> for "()()()(()" is index 6 >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Algorithm Geeks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- "People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily." -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
