Questions tagged [comparative-review]
This tag is used for questions which present a problem and multiple solutions, where the asker wishes to know which solution is best (and why).
944 questions
5
votes
2
answers
351
views
MinMaxStack - tracks minimum and maximum values
I'm implementing a MinMaxStack<T> in C++20 that tracks minimum and maximum values. The class needs T to support ...
2
votes
2
answers
256
views
Benchmarking in Java some super linearithmic sorting algorithms
Intro
A sort is called super linearithmic if its running time is \$\omega(N \log N)\$. For example, \$f(N) = \omega(g(N))\$ means that \$f(N)\$ grows "faster" than \$g(N)\$. In this post, I ...
0
votes
1
answer
187
views
Does an indentation style which uniquely identifies a column position to its role in the construct it belongs to make Bash code more readable?
What I'm asking here is whether do you think the facts
there is no type enforcing;
there is no indentation enforcing
consoles do not syntax highlight
consoles do not emphasize multi-line input a-la ...
1
vote
0
answers
41
views
Pure and impure Implementations of CSV parser in Clojure
There are two versions of the CSV parser. The latter seems to be more performant than the former, although the former's code is easier to read.
Variant 1, which parses a string:
...
0
votes
1
answer
128
views
Staff Rostering Problem - Minimize max night-shift
I'm doing some mini projects for my club related to fundamental optimization and am having a bit of trouble with this issue.
There are N employees numbered 1, 2, ..., N who need to be scheduled for ...
1
vote
2
answers
152
views
Translating an image encoded as u32 to an array
I have a function in an embedded system which translates an image encoded in a 32-bit integer to 3x9 matrix (an array of arrays):
...
9
votes
2
answers
463
views
Simple LRU cache implementations in C++20
LRU cache is a classical design pattern frequently questioned in programming technical interviews. It is best illustrated with pictures. Here are two examples.
The following are two alternative ...
7
votes
5
answers
894
views
7
votes
2
answers
671
views
C vs. C++: comparing function pointer tables and switch-case for multiple types support
I have some API code that I need to rewrite. The original API is written in C++ and relies heavily on templates and modern C++ features like std::is_same_v. The ...
1
vote
0
answers
46
views
Making a shell around jointjs for react, wondering between two approaches
The React tutorial of joint js shows a way to use jointjs in react. The tutorial is quite limited: it is basically defining a special named div and putting all jointjs code inside.
The jointjs ...
4
votes
1
answer
73
views
Better Microsoft SQL update
I've got the following SQL that I need to update by adding a new parameter:
...
2
votes
1
answer
146
views
Refactoring Agreement Status Logic: Applying SOLID Principles and Separating Logging/Auditing with Decorators
I have some production code that contains a lot of repetition and mixes business logic with auditing and logging. I've made two attempts at refactoring it, primarily using decorators. I'd like to get ...
4
votes
2
answers
156
views
Generic ring-buffer
What would be the preferred C way of implementing a simple generic ring-buffer.
Which approach from the 2 below (or even some 3rd) would you use and why?
Specifically, this will be part of an embedded ...
3
votes
0
answers
130
views
Comparing two Tree sort algorithm variations implemented in Java
I have this repository. It contains three variations of a simple sorting algorithm for integer keys.
The idea is that we keep a balanced BST in which each node holds the integer key and its frequency. ...
3
votes
2
answers
766
views
More Square Root
This is a follow up question to my Studies on Square Roots post. I'm posting additional code for solving for square root similar to the other, but with more code to benchmark.
...