prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Mergesort Update Variable Names
  I was looking over the mergesort.py file in the divide_and_conquer directory when I saw that all of the variable names are a single letter and there is not much documentation. Does anyone know enough about this file to improve the variable names and make the code more understandable?
  
  </issue>
  <code>
  [start of divide_and_conquer/mergesort.py]
  1 def merge(a, b, m, e):
  2     l = a[b : m + 1]  # noqa: E741
  3     r = a[m + 1 : e + 1]
  4     k = b
  5     i = 0
  6     j = 0
  7     while i < len(l) and j < len(r):
  8         # change sign for Descending order
  9         if l[i] < r[j]:
  10             a[k] = l[i]
  11             i += 1
  12         else:
  13             a[k] = r[j]
  14             j += 1
  15         k += 1
  16     while i < len(l):
  17         a[k] = l[i]
  18         i += 1
  19         k += 1
  20     while j < len(r):
  21         a[k] = r[j]
  22         j += 1
  23         k += 1
  24     return a
  25 
  26 
  27 def mergesort(a, b, e):
  28     """
  29     >>> mergesort([3,2,1],0,2)
  30     [1, 2, 3]
  31     >>> mergesort([3,2,1,0,1,2,3,5,4],0,8)
  32     [0, 1, 1, 2, 2, 3, 3, 4, 5]
  33     """
  34     if b < e:
  35         m = (b + e) // 2
  36         # print("ms1",a,b,m)
  37         mergesort(a, b, m)
  38         # print("ms2",a,m+1,e)
  39         mergesort(a, m + 1, e)
  40         # print("m",a,b,m,e)
  41         merge(a, b, m, e)
  42         return a
  43 
  44 
  45 if __name__ == "__main__":
  46     import doctest
  47 
  48     doctest.testmod()
  49
  [end of divide_and_conquer/mergesort.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/divide_and_conquer/mergesort.py b/divide_and_conquer/mergesort.py
  --- a/divide_and_conquer/mergesort.py
  +++ b/divide_and_conquer/mergesort.py
  @@ -1,45 +1,48 @@
  -def merge(a, b, m, e):
  -    l = a[b : m + 1]  # noqa: E741
  -    r = a[m + 1 : e + 1]
  -    k = b
  +def merge(arr, left, mid, right):
  +    # overall array will divided into 2 array
  +    # left_arr contains the left portion of array from left to mid
  +    # right_arr contains the right portion of array from mid + 1 to right
  +    left_arr = arr[left : mid + 1]
  +    right_arr = arr[mid + 1 : right + 1]
  +    k = left
       i = 0
       j = 0
  -    while i < len(l) and j < len(r):
  +    while i < len(left_arr) and j < len(right_arr):
           # change sign for Descending order
  -        if l[i] < r[j]:
  -            a[k] = l[i]
  +        if left_arr[i] < right_arr[j]:
  +            arr[k] = left_arr[i]
               i += 1
           else:
  -            a[k] = r[j]
  +            arr[k] = right_arr[j]
               j += 1
           k += 1
  -    while i < len(l):
  -        a[k] = l[i]
  +    while i < len(left_arr):
  +        arr[k] = left_arr[i]
           i += 1
           k += 1
  -    while j < len(r):
  -        a[k] = r[j]
  +    while j < len(right_arr):
  +        arr[k] = right_arr[j]
           j += 1
           k += 1
  -    return a
  +    return arr
   
   
  -def mergesort(a, b, e):
  +def mergesort(arr, left, right):
       """
  -    >>> mergesort([3,2,1],0,2)
  +    >>> mergesort([3, 2, 1], 0, 2)
       [1, 2, 3]
  -    >>> mergesort([3,2,1,0,1,2,3,5,4],0,8)
  +    >>> mergesort([3, 2, 1, 0, 1, 2, 3, 5, 4], 0, 8)
       [0, 1, 1, 2, 2, 3, 3, 4, 5]
       """
  -    if b < e:
  -        m = (b + e) // 2
  +    if left < right:
  +        mid = (left + right) // 2
           # print("ms1",a,b,m)
  -        mergesort(a, b, m)
  +        mergesort(arr, left, mid)
           # print("ms2",a,m+1,e)
  -        mergesort(a, m + 1, e)
  +        mergesort(arr, mid + 1, right)
           # print("m",a,b,m,e)
  -        merge(a, b, m, e)
  -        return a
  +        merge(arr, left, mid, right)
  +        return arr
   
   
   if __name__ == "__main__":
  
verification_info: {"golden_diff": "diff --git a/divide_and_conquer/mergesort.py b/divide_and_conquer/mergesort.py\n--- a/divide_and_conquer/mergesort.py\n+++ b/divide_and_conquer/mergesort.py\n@@ -1,45 +1,48 @@\n-def merge(a, b, m, e):\n-    l = a[b : m + 1]  # noqa: E741\n-    r = a[m + 1 : e + 1]\n-    k = b\n+def merge(arr, left, mid, right):\n+    # overall array will divided into 2 array\n+    # left_arr contains the left portion of array from left to mid\n+    # right_arr contains the right portion of array from mid + 1 to right\n+    left_arr = arr[left : mid + 1]\n+    right_arr = arr[mid + 1 : right + 1]\n+    k = left\n     i = 0\n     j = 0\n-    while i < len(l) and j < len(r):\n+    while i < len(left_arr) and j < len(right_arr):\n         # change sign for Descending order\n-        if l[i] < r[j]:\n-            a[k] = l[i]\n+        if left_arr[i] < right_arr[j]:\n+            arr[k] = left_arr[i]\n             i += 1\n         else:\n-            a[k] = r[j]\n+            arr[k] = right_arr[j]\n             j += 1\n         k += 1\n-    while i < len(l):\n-        a[k] = l[i]\n+    while i < len(left_arr):\n+        arr[k] = left_arr[i]\n         i += 1\n         k += 1\n-    while j < len(r):\n-        a[k] = r[j]\n+    while j < len(right_arr):\n+        arr[k] = right_arr[j]\n         j += 1\n         k += 1\n-    return a\n+    return arr\n \n \n-def mergesort(a, b, e):\n+def mergesort(arr, left, right):\n     \"\"\"\n-    >>> mergesort([3,2,1],0,2)\n+    >>> mergesort([3, 2, 1], 0, 2)\n     [1, 2, 3]\n-    >>> mergesort([3,2,1,0,1,2,3,5,4],0,8)\n+    >>> mergesort([3, 2, 1, 0, 1, 2, 3, 5, 4], 0, 8)\n     [0, 1, 1, 2, 2, 3, 3, 4, 5]\n     \"\"\"\n-    if b < e:\n-        m = (b + e) // 2\n+    if left < right:\n+        mid = (left + right) // 2\n         # print(\"ms1\",a,b,m)\n-        mergesort(a, b, m)\n+        mergesort(arr, left, mid)\n         # print(\"ms2\",a,m+1,e)\n-        mergesort(a, m + 1, e)\n+        mergesort(arr, mid + 1, right)\n         # print(\"m\",a,b,m,e)\n-        merge(a, b, m, e)\n-        return a\n+        merge(arr, left, mid, right)\n+        return arr\n \n \n if __name__ == \"__main__\":\n", "issue": "Mergesort Update Variable Names\nI was looking over the mergesort.py file in the divide_and_conquer directory when I saw that all of the variable names are a single letter and there is not much documentation. Does anyone know enough about this file to improve the variable names and make the code more understandable?\n", "before_files": [{"content": "def merge(a, b, m, e):\n    l = a[b : m + 1]  # noqa: E741\n    r = a[m + 1 : e + 1]\n    k = b\n    i = 0\n    j = 0\n    while i < len(l) and j < len(r):\n        # change sign for Descending order\n        if l[i] < r[j]:\n            a[k] = l[i]\n            i += 1\n        else:\n            a[k] = r[j]\n            j += 1\n        k += 1\n    while i < len(l):\n        a[k] = l[i]\n        i += 1\n        k += 1\n    while j < len(r):\n        a[k] = r[j]\n        j += 1\n        k += 1\n    return a\n\n\ndef mergesort(a, b, e):\n    \"\"\"\n    >>> mergesort([3,2,1],0,2)\n    [1, 2, 3]\n    >>> mergesort([3,2,1,0,1,2,3,5,4],0,8)\n    [0, 1, 1, 2, 2, 3, 3, 4, 5]\n    \"\"\"\n    if b < e:\n        m = (b + e) // 2\n        # print(\"ms1\",a,b,m)\n        mergesort(a, b, m)\n        # print(\"ms2\",a,m+1,e)\n        mergesort(a, m + 1, e)\n        # print(\"m\",a,b,m,e)\n        merge(a, b, m, e)\n        return a\n\n\nif __name__ == \"__main__\":\n    import doctest\n\n    doctest.testmod()\n", "path": "divide_and_conquer/mergesort.py"}]}