The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

Insertion sort in python

Insertion sort in python

0
Votes
0
Answer

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
Def insertion_sort(my_list)
n = len(my_list)
For I in range(1,n)
Value = my_list[1]
*** 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 ********
Return my_list

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?.
 
Thank you 
 

 
No answers so far.
×
LAST CHANCE
Ready to Learn Data Science?
50% OFF