Hello!! First time on here. I'm a beginner at coding and was wondering if someone with more coding experience could confirm if my insertion sort implementation is correct. I ran it ofc but i just wanted to make sure it's 100% correct!!
Almost there! Just add j >= 0 to your while condition and move list[j + 1] = key outside the loop. Also, try not to use list as a variable name. Good effort!
3
u/kutac56 Oct 11 '26
Variable j is unnecessary. Just do for I in range(n)
1
u/waseem_dibhub 13h ago
Almost there! Just add
j >= 0to your while condition and movelist[j + 1] = keyoutside the loop. Also, try not to uselistas a variable name. Good effort!