Comment

Comment by HarHarVeryFunny

Isn't that more of an implementation detail?

I'd guess if you care more about speed than memory it might be faster to just move elements into new array - sequence through old array appending to start/end of new array according to pivot comparison. You'd be moving every element vs leaving some in place with a swap approach, but the simplicity of the code & branch prediction might win out.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton