From 1f23338150e04776e05afe138fa5f768cb3a7743 Mon Sep 17 00:00:00 2001 From: marina <138340846+bt3gl-cryptographer@users.noreply.github.com> Date: Wed, 2 Aug 2023 23:41:46 -0700 Subject: [PATCH] Update insertion_sort.py --- sorting/insertion_sort.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sorting/insertion_sort.py b/sorting/insertion_sort.py index 861a804..b60c520 100644 --- a/sorting/insertion_sort.py +++ b/sorting/insertion_sort.py @@ -1,13 +1,13 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# author: bt3gl -def insertion_sort(lst): - for i in range(1, len(lst)): +def insertion_sort(array): + + for i in range(1, len(array)): current_index = i - while current_index > 0 and lst[current_index - 1] > lst[current_index]: + while current_index > 0 and array[current_index - 1] > array[current_index]: - lst[current_index], lst[current_index - 1] = lst[current_index - 1], lst[current_index] + array[current_index], array[current_index - 1] = array[current_index - 1], array[current_index] current_index -= 1