4

Here's the problem: I have some $n$ ordered containers, each with $m$ slots. I have $p$ temporary slots that I can use to move items between containers. Sorting within containers is not costly, however moving items between containers is, so the more temporary slots that can be used to move items between containers, the better.

More succinctly:

  • There are $n$ containers with $m$ indices.
  • There is an always-accessible container with $p$ indices.
  • The $p$-container starts empty.
  • Only one $n$-container can be opened at a time.
  • Switching which $n$-container is opened is costly, and should be minimized.
  • Swapping items between the opened $n$-container and the $p$-container has the same cost as any normal swap. I.e. there is no additional cost for swapping items between the temporary container and the opened container.

Take this in the case of sorting Minecraft chests: this gives $m=p=27$. You can only open one chest at a time, but you can move items however you want between that chest and your inventory.

I want to sort my chests so that it's easier to find things. Strategies such as Bubble Sort and Selection Sort could work, but they would take a long time as they wouldn't take advantage of all 27 temporary spaces. Is there a sorting algorithm that's memorizable and executable by a human to efficiently sort between containers?

Aly
  • 141
  • 4

0 Answers0