3 ms·
Upon seeing the description of the problem, my first thought was "use a sorting network" too, although I'd probably try to use fewer registers...
by userbinator 11y ago
Upon seeing the description of the problem, my first thought was "use a sorting network" too, although I'd probably try to use fewer registers...
- ggreer 11y agoFor this problem, I wouldn't worry too much about register usage. The x86-64 ISA has 16 GP and 16 FP registers, but modern implementations use register renaming[1] to give many more under the hood. For example, Haswell has 168 GP and 168 FP entries in its register file.[2] This contest was purely about speed, so one should favor using as many registers as possible when making any time-memory tradeoffs. 1. https://en.wikipedia.org/wiki/Register_renaming https://en.wikipedia.org/wiki/Register_renaming 2. http://www.realworldtech.com/haswell-cpu/3/ http://www.realworldtech.com/haswell-cpu/3/