4 ms·
This surprisingly made this easy to remember for me. Unfortunately, the merge sort instructions doesn't make sense to me, specifically step 3.
by theogravity 1y ago
This surprisingly made this easy to remember for me.
Unfortunately, the merge sort instructions doesn't make sense to me, specifically step 3.
- jfengel 1y agoIt'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 1y agoWrong diagram - “merge sort”.
- NetMageSCW 1y agoThe 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.