4 ms·
The thing to focus on in the mental load. What are you more likely to get right? a = sort(x,y,z); return a[1] or something like this? if(x >= y && x
by geocar 9y ago
The thing to focus on in the mental load. What are you more likely to get right?
a = sort(x,y,z); return a[1]
or something like this?
if(x >= y && x =< z) return x;
if(y >= x && y =< z) return y;
if(z >= x && z =< y) return z;
if(x >= z && x =< y) return x;
if(y >= z && y =< x) return y;
if(z >= y && z =< x) return z;
…
- thaumasiotes 9y agoreturn max(low, ( min(val, high) )); Still hard to avoid comparisons.