top | item 45365819

(no title)

theogravity | 5 months ago

This surprisingly made this easy to remember for me.

Unfortunately, the merge sort instructions doesn't make sense to me, specifically step 3.

discuss

order

NetMageSCW|5 months ago

The key to step 3 (of the merge sort) is the little nx in the middle that tells you to repeat step 3 n times. Each time, you take a right or left branch based on if the new weight from the half plank is lighter or heavier than the current weight. You also have to understand that step 1 means you recursively merge sort each half before you merge the two sorted halves.

jfengel|5 months ago

It's not a merge sort, it's just a partition. Mark every element greater than your pivot as "move right". Then step 4 marks every smaller element as "move left". Step 5 actually does that.

You don't really need to split that into 3 steps, though it looks a bit more like a real IKEA diagram with the extra steps.

NetMageSCW|5 months ago

Wrong diagram - “merge sort”.