In a real life system what is the usual use case for this?
Let's say a user reorders documents with drag and drop. What's the low-level equivalent? Could you help me come up with an algorithm that depends on this?
If write speed is important, I'd just use an in-memory LevelDB-like thing (so a log structured merge tree).
If the data is not much, then I'd optimize for code simplicity.
Re:So You Want to Rust the Linux Kernel?
by volta83 on Tuesday October 12, 2021 @08:34AM
(#28838898)
Before I delve more, are you talking about `rotate` ?
https://en.cppreference.com/w/cpp/algorithm/rotate
Is that what you want?
This is a joke, right? I don't see how it can't be.
But in case it isn't, in almost all problems like this it is assumed that you don't want to change the order of the other elements.
For example, if you wrote a function MoveToDirectlyAfter(a, b), and it did move elements other than a or b people would say that your function contains bugs or that it doesn't do what it says.