chapter_sorting/selection_sort/ #514
Replies: 10 comments 23 replies
-
k神好,分别包含n,n-1,...,2,2轮内循环,是不是多了一个2呀 |
Beta Was this translation helpful? Give feedback.
-
第三个特性 -- “非稳定排序”,在图例中显示了两个元素4的相对位置发生了改变。请问现实中什么时候会需要规避这种情况呢? |
Beta Was this translation helpful? Give feedback.
-
k神,我觉得最后一步交换元素可以有个小优化,在交换前判断 |
Beta Was this translation helpful? Give feedback.
-
// 将该最小元素与未排序区间的首个元素交换 如果未排序区间第一个值就是最小的,即最小元素与未排序区间首个元素是同一个,是不是就不用swap了? |
Beta Was this translation helpful? Give feedback.
-
代码里的注释感觉不是太准确。外层循环说是未排序区间内的,内层循环已经是从j=i+1开始了,前面这个i就不是未排序的区间吗? |
Beta Was this translation helpful? Give feedback.
-
这个非自适应排序要怎么理解?为什么是非自适应排序? |
Beta Was this translation helpful? Give feedback.
-
最后一个例子,是否可以更换一下呢?4 4 3 1 5 2,完整的排序后,4 4的相对位置没有发生改变。可以改为3 4 4 3 2例子。 |
Beta Was this translation helpful? Give feedback.
-
你好,关于java的例子,外层的循环,应该是 i<n,这样循环的区间就已经是[0, n-1],或者是 i<=n-1 |
Beta Was this translation helpful? Give feedback.
-
到这里我已经看得很吃力了,不是说看不懂就是感觉有一个屏障突破不了可能之前的一些代码没看,落下的债,先去写写题,看看视频,积累一些零碎的东西,过几天再来看,写blog的时候网站崩了,写的都清0我的心态也崩了,ok就这样,作者加油 |
Beta Was this translation helpful? Give feedback.
-
选择排序的不稳定性,这张示例图体现不出来,不稳定性应该是左边的数导致的,而不是因为后面的两个数。 |
Beta Was this translation helpful? Give feedback.
-
chapter_sorting/selection_sort/
一本动画图解、能运行、可提问的数据结构与算法入门书
https://www.hello-algo.com/chapter_sorting/selection_sort/
Beta Was this translation helpful? Give feedback.
All reactions