@Rohit

Consider : (a+)b

The above is not well formed! :)

On 11 June 2010 11:58, Rohit Saraf <rohit.kumar.sa...@gmail.com> 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
>
>
> On Fri, Jun 11, 2010 at 11:09 AM, BALARUKESH <sbalarukesh1...@gmail.com>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 algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> 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 algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
"Reduce, Reuse and Recycle"
Regards,
Vivek.S

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to