In the search and sort section in the python programming bootcamp I dont understand the insertion sort.
Below is the code. The part where I put astericks are the parts I dont understand
Start your code here
n = len(my_list)
For I in range(1,n)
Value = my_list
*** J = 1
While j > 0 and my_list[j-1] > value
My_list[j] = my_list[j-1]
J = j -1
My_list[j] = value ********
When the instructor was testing his code he used the bubble sort function instead of the insertion sort function. Is that meant to be so?.
thanks for reaching out! You’re not supposed to use bubble_sort() to test the insertion sort algorithm. You can now download the updated Notebook file from the lecture.
The 365 Team