10 votes

Detecting balanced parentheses

The code layout looks good, and you gave the functions and variables meaningful names. That being said, you could consider using longer variable names for the single-letter ones. Perhaps, ...
toolic's user avatar
  • 3,181
8 votes
Accepted

Detecting balanced parentheses

Permit me to add the following to the review posted by toolic: Use Docstrings I would add a docstring to function validate_brackets describing its functionality. ...
Booboo's user avatar
  • 1,636
6 votes

Stack - implementation in Java

Methods Idiomatic methods of the Stack data structure include trio performing operations with the last element push, pop and <...
Alexander Ivanchenko's user avatar
6 votes
Accepted

Stack - implementation in Java

private E[] data; private E[] buffer; Things start off a bit mysterious, a stack containing two arrays instead of just one. In principle that's fine I suppose but ...
harold's user avatar
  • 9,559
4 votes

Stack - implementation in Java

There's two good reviews already, I'm trying not to repeat them. // Properties Comments like this are 100% useless. You spent valuable time writing them but they ...
TorbenPutkonen's user avatar
3 votes

Stack - implementation in Java

You have 39 occurrences of this. in your code. I've heard it said that Java is verbose, but you're taking verbosity to a whole new level! I would delete every one ...
AJNeufeld's user avatar
  • 33.5k
3 votes
Accepted

Generic stack implementation

Advice I - unsigned int memb_size This is a counter. Therefore, I suggest using a data type that is tailored for counting: ...
coderodde's user avatar
  • 28.2k
3 votes

Detecting balanced parentheses

The code is lean and maintainable. There are minor issues: predicate naming Predicates shall start with e. g. is_... or has_... ...
stefan's user avatar
  • 2,925
3 votes

Detecting balanced parentheses

Separate out the brackets There's a bit of preprocessing necessary for the brackets: Validation Separation of keys and values You can just preprocess the brackets again and again and again each time ...
Matthieu M.'s user avatar
  • 5,137
3 votes

Detecting balanced parentheses

Minor improvement maybe: Replacing if not stack or c != brackets[stack[-1]]: return False stack.pop() with: ...
Kelly Bundy's user avatar
  • 3,134
2 votes

Functions to simplify printing strings and numbers in amd64 Assembly

If during a function call to the two push functions, there's existing string on the stack, the functions automatically pack data on to the stack to avoid any null character in the middle of the string ...
Sep Roland's user avatar
  • 4,408
2 votes

Functions to simplify printing strings and numbers in amd64 Assembly

Most arithmetic operations affect the flags So for example after and rcx, 7, you don't need a test rcx, rcx to check whether <...
harold's user avatar
  • 9,559
2 votes

`strdup` re-implementation in assembly

If you’re writing x86_64 code, you should be following the System V x86_64 ABI. I’m not sure where your _ft_ versions of the system calls are coming from, but you ...
Davislor's user avatar
  • 7,371
2 votes
Accepted

Generic stack implementation (revision)

Name space Code is taking up stack, stack_..., Stack, ...
chux - Reinstate Monica's user avatar
1 vote

Generic stack implementation (revision)

Use-after-free bug: In stack_pop(): ...
Harith's user avatar
  • 5,669

Only top scored, non community-wiki answers of a minimum length are eligible