guys who don't understand the above code use this arr = [7,1,4,5,3,2] for i in range(1, len(arr)): curr = arr[i] for j in range(i, 0, -1): if arr[j - 1] > curr: arr[j] = arr[j - 1] else: arr[j] = curr break else: arr[0] = curr print(arr)
Thanks bro i dont know about your channel but google bard recommended your channel Complete Python DSA Video podunga bro youtube la full ah tamil video illai
Bro Nenga romba clear ah soli kudukuringa It's be perfect Thank you And I messaged u in Instagram regarding some doubts Please consider that And the telegram link is not applicable Please recheck
we can also do like this la !!! #insertion sort x=[7,1,5,3,0,4,2,6,-1] for i in range(1,len(x)): for j in range(i-1,-1,-1): if x[j]>x[i]: x[i],x[j]=x[j],x[i] i-=1 print(x)