New answers tagged algorithm
0
votes
Finding a sequence of xors to change a to b
Here are some general coding style suggestions.
UX
When I run the code, it sits there waiting for input, but I have no idea what I should type at the prompt.
Instead of a bare ...
8
votes
Finding a sequence of xors to change a to b
You can improve the performance by using an \$O(1)\$ algorithm.
Turn all the bits on.
...
3
votes
Dijkstra's algorithm for non-uniform undirected hypergraphs: Take II - bidirectional Dijkstra's algorithm with excellent performance
Always document your generic parameters. Since all methods in the class take the same parameters, it might be easier to document them if the methods were instance methods instead of static.
You have ...
6
votes
BRESort - Bitwise Relationship Extraction - Intelligent Adaptive Sorting Engine for 32/64-bit & Floating-Point Data
Naming
A consistent prefix is useful, yet code makes public
...
7
votes
BRESort - Bitwise Relationship Extraction - Intelligent Adaptive Sorting Engine for 32/64-bit & Floating-Point Data
I advise against having an interface start out as elaborate as in bresort_research.h - imagine having to keep everything backwards compatible.
I see a lot of code repeating - a maintenance nightmare ...
3
votes
My BRESort adaptive sorting engine in C
Compiler warnings
Code performs about 10 casual signed to/from unsigned conversions. Consider enabling more compiler warnings to identify.
Array sizing
As an alternative for ...
4
votes
My BRESort adaptive sorting engine in C
In addition to the previous answers, here are some other minor suggestions.
Documentation
There are a lot of helpful comments. It would be good to
explain what "BRE" stands for, if it is an ...
6
votes
My BRESort adaptive sorting engine in C
I think overall readability OK.
There is an ambiguity in the documentation in the header:
Minimal memory overhead (256 bytes) - does this mean maximal overhead is ...
8
votes
My BRESort adaptive sorting engine in C
Without seeing all of the code, based only on what I can see, I'm not a fan of the 0, 1, and ...
1
vote
Breadth First Search Block Puzzle
UX
When I run the code with the -h argument, I get a vague error message
...
3
votes
Dijkstra's algorithm for non-uniform undirected hypergraphs
I'll just focus on the code, as math and related subjects are generally better answered by anybody but me. In general the code looks quite good though, so I'll start with that.
The good
Guard ...
4
votes
Accepted
Dijkstra's algorithm for non-uniform undirected hypergraphs
It doesn't seem like a hyperedge cares about the order in which its nodes are connected or vice versa, and it doesn't seem like the same node should be able to appear multiple times on the same ...
2
votes
Check whether a binary tree is symmetric
Re. avoidable effort: nesting the None checks avoids one or two of three comparisons for nodes with two children:
...
1
vote
Check whether a binary tree is symmetric
Your recursive solution to this is a reasonable approach for a recursive data structure. There is an opportunity to abstract getting mirrored nodes out from the process of checking for their equality ...
7
votes
Check whether a binary tree is symmetric
communicating with humans
Something that can take a long time for junior devs to realize
is that coding is primarily about communicating a technical
idea to colleagues.
programs must be written for ...
2
votes
Implementation of a kd-tree header-only library
Missing definitions
You have failed to provide definitions for the following:
printf (presumably std::printf from ...
6
votes
Check whether a binary tree is symmetric
In addition to the previous answer by @Toby Speight, here are some general coding style suggestions.
Documentation
The PEP 8 style guide recommends
adding docstrings for classes and functions.
You ...
8
votes
Accepted
Check whether a binary tree is symmetric
I note that this algorithm determines tests whether the tree's structure is symmetric, as well as the content. I haven't seen the problem specification, so have to assume that that is a requirement - ...
Top 50 recent answers are included
Related Tags
algorithm × 5119java × 1293
python × 1209
performance × 1012
c++ × 855
programming-challenge × 664
javascript × 488
c# × 401
strings × 357
c × 336
python-3.x × 324
sorting × 322
beginner × 306
graph × 260
time-limit-exceeded × 256
array × 248
tree × 213
recursion × 177
interview-questions × 168
python-2.x × 164
combinatorics × 134
complexity × 134
mathematics × 112
pathfinding × 102
c++11 × 101