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, ...
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.
...
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 <...
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 ...
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 ...
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 ...
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: ...
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_... ...
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 ...
3
votes
Detecting balanced parentheses
Minor improvement maybe: Replacing
if not stack or c != brackets[stack[-1]]:
return False
stack.pop()
with:
...
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 ...
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 <...
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 ...
2
votes
Accepted
Generic stack implementation (revision)
Name space
Code is taking up stack, stack_..., Stack, ...
1
vote
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
stack × 414java × 130
c++ × 108
c × 71
linked-list × 59
algorithm × 48
beginner × 47
python × 38
queue × 35
performance × 32
c# × 26
reinventing-the-wheel × 25
c++11 × 24
array × 22
interview-questions × 20
programming-challenge × 18
balanced-delimiters × 16
javascript × 15
python-3.x × 14
strings × 13
pointers × 11
math-expression-eval × 11
sorting × 10
memory-management × 10
complexity × 10