程序代写代做 Insertion sort

Insertion sort
½«Ò»¸ölistÀïÊý²»¶Ï°´Ðò²åÈëÁíÒ»¸ösorted listÖÐ

Insertion sort
½«Ò»¸ölistÀïÊý²»¶Ï°´Ðò²åÈëÁíÒ»¸ösorted listÖÐ
Target list
Sorted list
[1,2,3,4]
[]
[2,3,4]
[1]
[3,4]
[1,2]
[4]
[1,2,3]
[]
[1,2,3,4]

Merge
½«Á½¸öÒѾ­´ÓСµ½´óÅÅÁеÄlist°´ÕÕ´ÓСµ½´óµÄ˳ÐòºÏ²¢ Merge [1,3,6,8,2,5,7] = [1,2,3,5,6,7,8]

[2,3]
Merge Sort-·ÖÁÑ [2,3,2,5,0]
[2,3,2] [5,0] [2] [5]
[3]
[0]
[2]

[2,3]
Merge Sort-ºÏ²¢ [0,2,2,3,5]
[2,2,3] [0,5] [2] [5]
[3]
[0]
[2]

Complexity
[0,2,2,3,5]
[2,2,3] [0,5]
[2,3]
[2] [5]
[0]
[2]
[3]

[2,3]
Complexity
[0,2,2,3,5]
[2,2,3] [0,5]
[2] [5]
[3]
merge [1,2,3] [4,5,6] = [1,2,3,4,5,6] merge [2,3,5] [1,2,6] = [1,2,3,4,5,6]
[0]
[2]