Algorithm question: in-place multi-bringToFront?

mw mingwu at gmail.com
Fri May 29 00:37:09 UTC 2020


On Friday, 29 May 2020 at 00:32:13 UTC, mw wrote:

>
> If you don’t care the remaining elements’ order, just swap the 
> head N elements with the index array’s pointing to. (unstable 
> swap, linear to N=index.length)

Note: If index[i] < index.length, don’t swap that element.




More information about the Digitalmars-d mailing list