# sorting advanced

Sort Each Half, Then Merge

Two helpers each sort half the deck, then you merge their piles β€” teamwork makes sorting fast! 🀝

You get a list of nums. Split it in the middle, sort each half yourself (any hand-built sort), then MERGE the halves. Print comma-separated.

Example:

Input: nums = [8, 3, 9, 1, 5, 2] Output: 1,2,3,5,8,9

Splitting into [8, 3, 9] and [1, 5, 2], sorting each half to [3, 8, 9] and [1, 2, 5], then merging the two sorted halves gives 1,2,3,5,8,9.

πŸ’‘ need a hint?

sort-halves-then-merge.pyπŸ”’ given lines are locked β€” write your code in between
loading...