Skip to main content

Timeline for Check for balanced parentheses

Current License: CC BY-SA 3.0

13 events
when toggle format what by license comment
Apr 13, 2017 at 12:40 history edited CommunityBot
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Apr 2, 2014 at 19:35 history edited fgrieu CC BY-SA 3.0
After that change of 1., the test (str.length() % 2) != 0 becomes redundant
Apr 2, 2014 at 19:00 history edited fgrieu CC BY-SA 3.0
stack is synchronized, thus slow
Apr 2, 2014 at 17:18 history edited fgrieu CC BY-SA 3.0
Polish
Apr 2, 2014 at 13:54 history edited fgrieu CC BY-SA 3.0
The code is wrong after all
Apr 2, 2014 at 12:56 comment added Marc-Andre I would object to the test of the null string, since if you know that you will be throwing a NullPointerException than make a test that expect an exception. If for any reason something change and the exception is not throw anymore you will know it!
Apr 2, 2014 at 11:58 history edited fgrieu CC BY-SA 3.0
Polish
Apr 2, 2014 at 10:32 comment added fgrieu @200_success: very right! Fixed it. You guessed it, I'm not truly a Java programmer (I mostly use the Java Card 2 dialect, used in Smart Cards, in the variant where no variable can be int, we have only short)
Apr 2, 2014 at 10:31 history edited fgrieu CC BY-SA 3.0
Fix use of string rather than char[]
Apr 2, 2014 at 10:17 comment added 200_success 1) Good point that Stack.push() could take longer than O(1) time. It may be prudent to call Stack.ensureCapacity() to avoid any possible penalty of having to expand the stack. You could also use a char[] array. Strings are immutable in Java, though, and would not be suitable.
Apr 2, 2014 at 10:03 review First posts
Apr 2, 2014 at 11:05
Apr 2, 2014 at 9:51 history edited fgrieu CC BY-SA 3.0
There's a basic problem. Or is there?
Apr 2, 2014 at 9:45 history answered fgrieu CC BY-SA 3.0