Recursion depth
Warm-up · Trace the algorithm · about 5 min
Merge sort runs on the 8 values [5, 2, 4, 7, 1, 3, 2, 6]. Watch the split tree grow and answer the questions about its depth.
Example 1
Input:
{"values":[5,2,4,7,1,3,2,6]}
Output:
[1,2,2,3,4,5,6,7]
Constraints
- The trace uses the input shown.
- Answer with a whole number.
Learn the idea first: Merge sort, a visual lesson.
More Merge sort problems
- Breaking a tie in the merge Warm-up
- Merge two sorted arrays Standard
- Implement merge sort Standard
- Sort a linked list Standard
- Count inversions Challenge