Level 5 โ Algorithms โ Sorting, searching, recursion, dynamic programming, greedy, and graph algorithms.
Implement bubble, selection, insertion, merge, quick, and heap sort; analyse time complexity.
def merge_sort(arr):
if len(arr) <= 1: return arr
mid = len(arr) // 2
left = merge_sort(arr[:mid])
right = merge_sort(arr[mid:])
return merge(left, right)Sorting is the gateway to algorithmic thinking. Master O(nยฒ) and O(n log n) algorithms and understand when to use each.
Complete all tiers to earn up to 1,735 XP and unlock the next chapter.