@balarukesh.... thanks On Fri, Jun 11, 2010 at 11:58 AM, Rohit Saraf <[email protected]>wrote:
> @BALARUKESH : > What are you saying !! > and Why would this not work > > As you start you get sum -1 at start itself. Hence you quit. > The sum should be >0 always and 0 at last > > -------------------------------------------------- > Rohit Saraf > Second Year Undergraduate, > Dept. of Computer Science and Engineering > IIT Bombay > http://www.cse.iitb.ac.in/~rohitfeb14<http://www.cse.iitb.ac.in/%7Erohitfeb14> > > > On Fri, Jun 11, 2010 at 11:09 AM, BALARUKESH <[email protected]>wrote: > >> The increment and decrement method wont work correctly for all >> cases.... >> Ex:- >> ))a+b(( >> This is not a well formed parenthesis... But satisfies the algorithm. >> The better way is to use a stack... When u find a ' ( ' push it into >> the stack and when u find a ' )' pop off the top element. Finally the >> stack should be empty. If [stack has one or more ' ( ' ] or [the stack >> is empty and exp is not empty] then it is not a well formed >> parenthesis... >> >> -- >> 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]<algogeeks%[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]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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.
