Skip to main content

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

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 ...
toolic's user avatar
  • 15.6k
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. ...
Peilonrayz's user avatar
  • 44.5k
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 ...
TorbenPutkonen's user avatar
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 ...
chux's user avatar
  • 36.4k
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 ...
greybeard's user avatar
  • 7,561
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 ...
chux's user avatar
  • 36.4k
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 ...
toolic's user avatar
  • 15.6k
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 ...
greybeard's user avatar
  • 7,561
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 ...
Chris's user avatar
  • 4,224
1 vote

Breadth First Search Block Puzzle

UX When I run the code with the -h argument, I get a vague error message ...
toolic's user avatar
  • 15.6k
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 ...
Maarten Bodewes's user avatar
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 ...
Sara J's user avatar
  • 4,211
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: ...
greybeard's user avatar
  • 7,561
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 ...
Chris's user avatar
  • 4,224
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 ...
J_H's user avatar
  • 42k
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 ...
Toby Speight's user avatar
  • 88.2k
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 ...
toolic's user avatar
  • 15.6k
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 - ...
Toby Speight's user avatar
  • 88.2k

Top 50 recent answers are included

Morty Proxy This is a proxified and sanitized view of the page, visit original site.