{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreiamcr4rinofdl43m5ilmevetkzc37dro7w7urui77s6tb6bxr22l4",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mjn7iheqtxv2"
},
"path": "/t/t-sort-by-index-and-t-sort-by-key-and-index/24172#post_15",
"publishedAt": "2026-04-16T18:51:06.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "The O(N2) way is what `get_disjoint_mut` does, comparing every index against duplicates (and in range), which as you say is also a permutation if `N == len()`. But of course the assumption in that case is that `N` is usually small.",
"title": "`<[T]>::sort_by_index` and `<[T]>::sort_by_key_and_index`"
}