loading...

re: JavaScript ES6 one-liners: merge two sorted lists VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Seems easy to forget that the elegant new collection operators are still O loops under the hood.
 

Yep, I tried to remember it, yet had made a basic mistake of assuming that Array.prototype.shift() is O(1), yet it is O(n) in its most common implementations, including the one specified in the ECMAScript 2015 spec. The code would be O(n1+n2) if it used orderedList2[index_of_first_not_yet_merged_element] instead of shift.

As much as we have to consider big-o, I'm surprised someone hasn't rebuilt pgsql as a wasm 😂

Just... Whatever, batch insert and order by lol

Hah. An inverse of this?

I actually ported a legacy C code to wasm/emscripten, but source debugging sucks with wasm, so dropped that effort.

Code of Conduct Report abuse