GoalScope — merge_sort_iterative (Qwen2.5-Coder-32B-Instruct) — hover a token to see the patched verbalization
↵ <code>↵ def merge_sort_iterative(arr):↵ """Iterative bottom-up merge sort."""↵ n = len(arr)↵ width = 1↵ while width < n:↵ for i in range(0, n, 2 * width):↵ left = i↵ mid = min(i + width, n)↵ right = min(i + 2 * width, n)↵ merge(arr, left, mid, right)↵ width *= 2↵ ↵ def merge(arr, left, mid, right):↵ """Merge two sorted subarrays."""↵ left_arr = arr[left:mid]↵ right_arr = arr[mid:right]↵ i = j = 0↵ k = left↵ while i < len(left_arr) and j < len(right_arr):↵ if left_arr[i] <= right_arr[j]:↵ arr[k] = left_arr[i]↵ i += 1↵ else:↵ arr[k] = right_arr[j]↵ j += 1↵ k += 1↵ while i < len(left_arr):↵ arr[k] = left_arr[i]↵ i += 1↵ k += 1↵ while j < len(right_arr):↵ arr[k] = right_arr[j]↵ j += 1↵ k += 1↵ </code>