03. 插入排序 #63
Replies: 10 comments 3 replies
-
简单来说,「选择排序算法」是在每一趟排序中,将无序序列的第 1 个元素,插入到有序序列的适当位置上。 |
Beta Was this translation helpful? Give feedback.
-
已修正,感谢指正~~ |
Beta Was this translation helpful? Give feedback.
-
for i in range(1, len(nums)): |
Beta Was this translation helpful? Give feedback.
-
2.2步应该是比num[1]大的元素向后移动一位吧 |
Beta Was this translation helpful? Give feedback.
-
文字描述部分是否写反了?“从右到左遍历有序区间中的元素,将比 𝑛𝑢𝑚𝑠[1]小的元素向后移动 1 位。”,是否应该是将比num[1]大的元素往后移动一位?按照原文的说法输出就会是从大到小而不是从小到大。 |
Beta Was this translation helpful? Give feedback.
-
自己改下缩进
lst = [5,2,3,6,1,4] |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
自己写了一个简单的 |
Beta Was this translation helpful? Give feedback.
-
这样子写应该不算是插入排序吧 |
Beta Was this translation helpful? Give feedback.
-
03.插入排序 | 算法通关手册
插入排序 # 1. 插入排序算法思想 # 插入排序(Insertion Sort)基本思想: 将整个序列分为两部分:前面 i 个元素为有序序列,后面 n - i 个元素
https://algo.itcharge.cn/01.Array/02.Array-Sort/03.Array-Insertion-Sort/
Beta Was this translation helpful? Give feedback.
All reactions