Skip to main content

Hot answers tagged

6votes

Single Consumer Single Producer Wait-Free Zero-Copy Circular Message Queue

design document We need to understand the constraints you're working within, so you should write them down. There are some comments in the implementation, which are helpful, but that's no substitute ...
J_H's user avatar
  • 38.9k
5votes

Single Consumer Single Producer Wait-Free Zero-Copy Circular Message Queue

Be careful claiming it is wait-free You claim your queue is wait-free, but you have a potentially unbounded for-loop doing a compare-exchange operation. At the very ...
G. Sliepen's user avatar
4votes
Accepted

bilateral_filter Template Function Implementation for Image in C++

Move padding out of bilateral_filter() Most of the code in bilateral_filter() is spent on managing a padded version of the input ...
G. Sliepen's user avatar
4votes

Finding Special Parts in a Word

...
TorbenPutkonen's user avatar
4votes

Finding Special Parts in a Word

The "length 2" rule is unnecessary, just ignore it and read the "length ≥ 3" rule as "length ≥ 2" instead. You can simplify your code accordingly, removing the ...
Robert's user avatar
3votes

Efficient way to win points in chocolate bowl game

The loop in skipsNeededToWin can take long. It has two phases: For some time, both you and your friend always take bites. After that, only you take bites, and your ...
Robert's user avatar
2votes

Finding Special Parts in a Word

In such code, one should look for rules, smart logic. Here we have sequences x² and xyⁿx. (As already said in an earlier answer, with n = 0 one covers the first sequence.) The logic here is detecting ...
Joop Eggen's user avatar
1vote

Single Consumer Single Producer Wait-Free Zero-Copy Circular Message Queue

Just a little review. ... code style, variable names and API may change. (OP) Array indexing Code has typedef unsigned int index_t;, which I take as later code ...
chux's user avatar
  • 35.7k
1vote
Accepted

Dictionary based non-local mean implementation in Matlab

This function, dictionaryBasedNonlocalMean(), takes a "dictionary" of patches and an input patch, and returns the weighted mean of the dictionary patches. ...
Cris Luengo's user avatar
1vote

Find max in-order difference in array

Layout Lines like this: if len(A)==1: return 0 are customarily split across 2 lines: if len(A)==1: return 0 The black ...
toolic's user avatar
  • 11.1k

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

close