Insertion Sort - Part 2

  • + 0 comments

    Python Solution:

    def insertionSort2(n, arr):
        # Write your code here
        for i in range(len(arr)):
            part_sorted = sorted(arr[:(i+1)]) + arr[i+1:]
            if i > 0:
                print(' '.join([str(x) for x in part_sorted]))