5# array, and places all smaller (smaller than pivot)
6# to left of pivot and all greater elements to right
7# of pivot
8def partition(arr, low, high): 9 i = (low - 1) # index of smaller element
10 pivot = arr[high] # pivot
11
26# high --> Ending index
27
28# Function to do Quick sort
29def quick_sort(arr, low, high):30 if low < high:
31 # pi is partitioning index, arr[p] is now
32 # at right place
1"""Python program for implementation of Insertion Sort
2"""
3def insertion_sort(arr): 4 # Traverse through 1 to len(arr)
5 for i in range(1, len(arr)):
6 key = arr[i]
Two blank lines are expected between functions and classes.