prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Unnecessary Loop 
  https://github.com/TheAlgorithms/Python/blob/4e0184a41dd3e4838da484057d25e17234353da0/dynamic_programming/matrix_chain_order.py#L12-L15
  
  `Line 12` creates a NxN Matrix that **contains 0**. So there is no need for `Line 14-15`
  
  </issue>
  <code>
  [start of dynamic_programming/matrix_chain_order.py]
  1 from __future__ import print_function
  2 
  3 import sys
  4 '''
  5 Dynamic Programming
  6 Implementation of Matrix Chain Multiplication
  7 Time Complexity: O(n^3)
  8 Space Complexity: O(n^2)
  9 '''
  10 def MatrixChainOrder(array):
  11     N=len(array)
  12     Matrix=[[0 for x in range(N)] for x in range(N)]
  13     Sol=[[0 for x in range(N)] for x in range(N)]
  14     for i in range(1,N):
  15         Matrix[i][i]=0
  16 
  17     for ChainLength in range(2,N):
  18         for a in range(1,N-ChainLength+1):
  19             b = a+ChainLength-1
  20 
  21             Matrix[a][b] = sys.maxsize
  22             for c in range(a , b):
  23                 cost = Matrix[a][c] + Matrix[c+1][b] + array[a-1]*array[c]*array[b]
  24                 if cost < Matrix[a][b]:
  25                     Matrix[a][b] = cost
  26                     Sol[a][b] = c
  27     return Matrix , Sol
  28 #Print order of matrix with Ai as Matrix
  29 def PrintOptimalSolution(OptimalSolution,i,j):
  30     if i==j:
  31         print("A" + str(i),end = " ")
  32     else:
  33         print("(",end = " ")
  34         PrintOptimalSolution(OptimalSolution,i,OptimalSolution[i][j])
  35         PrintOptimalSolution(OptimalSolution,OptimalSolution[i][j]+1,j)
  36         print(")",end = " ")
  37 
  38 def main():
  39     array=[30,35,15,5,10,20,25]
  40     n=len(array)
  41     #Size of matrix created from above array will be
  42     # 30*35 35*15 15*5 5*10 10*20 20*25
  43     Matrix , OptimalSolution = MatrixChainOrder(array)
  44 
  45     print("No. of Operation required: "+str((Matrix[1][n-1])))
  46     PrintOptimalSolution(OptimalSolution,1,n-1)
  47 if __name__ == '__main__':
  48     main()
  49
  [end of dynamic_programming/matrix_chain_order.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/dynamic_programming/matrix_chain_order.py b/dynamic_programming/matrix_chain_order.py
  --- a/dynamic_programming/matrix_chain_order.py
  +++ b/dynamic_programming/matrix_chain_order.py
  @@ -11,8 +11,6 @@
       N=len(array)
       Matrix=[[0 for x in range(N)] for x in range(N)]
       Sol=[[0 for x in range(N)] for x in range(N)]
  -    for i in range(1,N):
  -        Matrix[i][i]=0
   
       for ChainLength in range(2,N):
           for a in range(1,N-ChainLength+1):
  
verification_info: {"golden_diff": "diff --git a/dynamic_programming/matrix_chain_order.py b/dynamic_programming/matrix_chain_order.py\n--- a/dynamic_programming/matrix_chain_order.py\n+++ b/dynamic_programming/matrix_chain_order.py\n@@ -11,8 +11,6 @@\n     N=len(array)\n     Matrix=[[0 for x in range(N)] for x in range(N)]\n     Sol=[[0 for x in range(N)] for x in range(N)]\n-    for i in range(1,N):\n-        Matrix[i][i]=0\n \n     for ChainLength in range(2,N):\n         for a in range(1,N-ChainLength+1):\n", "issue": "Unnecessary Loop \nhttps://github.com/TheAlgorithms/Python/blob/4e0184a41dd3e4838da484057d25e17234353da0/dynamic_programming/matrix_chain_order.py#L12-L15\r\n\r\n`Line 12` creates a NxN Matrix that **contains 0**. So there is no need for `Line 14-15`\n", "before_files": [{"content": "from __future__ import print_function\n\nimport sys\n'''\nDynamic Programming\nImplementation of Matrix Chain Multiplication\nTime Complexity: O(n^3)\nSpace Complexity: O(n^2)\n'''\ndef MatrixChainOrder(array):\n    N=len(array)\n    Matrix=[[0 for x in range(N)] for x in range(N)]\n    Sol=[[0 for x in range(N)] for x in range(N)]\n    for i in range(1,N):\n        Matrix[i][i]=0\n\n    for ChainLength in range(2,N):\n        for a in range(1,N-ChainLength+1):\n            b = a+ChainLength-1\n\n            Matrix[a][b] = sys.maxsize\n            for c in range(a , b):\n                cost = Matrix[a][c] + Matrix[c+1][b] + array[a-1]*array[c]*array[b]\n                if cost < Matrix[a][b]:\n                    Matrix[a][b] = cost\n                    Sol[a][b] = c\n    return Matrix , Sol\n#Print order of matrix with Ai as Matrix\ndef PrintOptimalSolution(OptimalSolution,i,j):\n    if i==j:\n        print(\"A\" + str(i),end = \" \")\n    else:\n        print(\"(\",end = \" \")\n        PrintOptimalSolution(OptimalSolution,i,OptimalSolution[i][j])\n        PrintOptimalSolution(OptimalSolution,OptimalSolution[i][j]+1,j)\n        print(\")\",end = \" \")\n\ndef main():\n    array=[30,35,15,5,10,20,25]\n    n=len(array)\n    #Size of matrix created from above array will be\n    # 30*35 35*15 15*5 5*10 10*20 20*25\n    Matrix , OptimalSolution = MatrixChainOrder(array)\n\n    print(\"No. of Operation required: \"+str((Matrix[1][n-1])))\n    PrintOptimalSolution(OptimalSolution,1,n-1)\nif __name__ == '__main__':\n    main()\n", "path": "dynamic_programming/matrix_chain_order.py"}]}