214 points · by andai · 3y ago · 66 comments
Might I suggest a different animation. The current one swaps two elements (bars) by vertically shrinking the taller bar and growing the shorter one. Instead, the bars should stay the same height but move horizontally. I would rather see values move than slots in the array morph to the new value they should hold. The current animation feels like you are pumping water from one tank to another.
There is a reason why conjunction (AND) is also called logical multiplication, and disjunction (OR) logical addition. There is not much difference between this and:
(oneIsGreater ? origArray[0] : 0) | (twoIsGreater ? origArray[1] : 0)
This is often useful to think about when working on bitset or SIMD algorithms.Really? The connection between AND and multiplication is obvious, but disjunction doesn't behave like addition. (For one thing, just like AND, it destroys information, which multiplication does do and addition doesn't.) Addition would usually be XOR.
In fact, AND and XOR are what you get when you apply multiplication and addition to the integers (mod 2).
Meaning, using only elementary arithmetic and modulo?
Seems like there should be either an obvious answer or an interesting one :)
A ⊢ ((A ∨ B) ∨ C) ... ∨ nBy that argument, conjunction is also called "addition". Perhaps there's a different reason?
The choice of terminology, contrasting "logical addition" with "logical multiplication", obviously indicates that logical addition is supposed to be analogous to addition. What is the analogy?
Pretty cool trick nevertheless, well done to the author!
It is actually pretty good - the code uses 10 comparisons, while the optimal sorting network for 5 elements uses 9: https://bertdobbelaere.github.io/sorting_networks.html#N5L9D...
> A sorting algorithm that checks if the array is sorted until a miracle occurs. It continually checks the array until it is sorted, never changing the order of the array.
It basically waits for god intervention / single event upset. It is guaranteed to be optimal in at least one quantum universe, though.
Welcome to our phone screen at ${faang}. For the warmup question, let's solve this ${lc_hard} together in css.
I'm having trouble determening as written if this is a joke or not.
If anyone looked at this and thought something along the lines of "wow, think of the possibilities", I would would ask only that they don't put more thought into it. Other thoughts could bring pain ... to the browser that has to run it, the user staring at the page as the fans spin up, and the developer who has the pleasure to work with it next.
This was clearly one of those interesting-yet-useless things that was worth a read.
*Obviously, abusing CSS isn’t everyone’s idea of fun.
I stopped reading there.
Let us know when the second part is out. Why write half an article?
I learned from the article and found the subject interesting, but the breathlessly excited tone and forced cuteness were offputting.
Twice the page views? To "drive engagement"?