当前位置:网站首页>Simple selection sort of selection sort
Simple selection sort of selection sort
2022-07-05 06:16:00 【Beauty of algorithm and programming】
1. introduction
As soon as I hear the words of selective sorting, my first reaction is to sort through selection , So is our first reaction right , Let's verify , Understand its definition . Simple selection sort : The simplest selection method is to scan the elements in the sequence sequentially , Remember the smallest element encountered ( At the end of a scan, the smallest element is found . Repeated scanning can complete the sorting work ). Obviously, that's what we understand , Each time, select the smallest element of the sequence and sort it in turn .
2. problem
Given a sequence , How do we sort it by simple selection sorting , The following will be described one by one .
Example 1:27,54,18,36,78,48
Output :18,27,36,48,54,78
3. Algorithm description
Example 1 It's an out of order sequence , What we need to do is to arrange the disordered sequence into a sequence from small to large . This problem is realized by simple selection sorting , According to the definition of simple sorting , The first is to find the smallest in the sequence , Then find the second smallest ( That is, in addition to the last found element , Find the smallest... From the remaining elements ), Repeat the search until the sorting is complete , This process is illustrated below .
4. Conclusion
The method is a simple exchange using a direct selection sorting algorithm , That is, the above position of exchanging two elements . This is my understanding of simple selection sorting , There may be a better understanding , I will continue to study .
Internship editor : Heng Hui
Source of contribution : Deep learning and cultural tourism application laboratory (DLETA)
边栏推荐
- 【Rust 笔记】17-并发(下)
- redis发布订阅命令行实现
- MySQL advanced part 1: stored procedures and functions
- Leetcode recursion
- A reason that is easy to be ignored when the printer is offline
- Is it impossible for lamda to wake up?
- Data visualization chart summary (II)
- Multi screen computer screenshots will cut off multiple screens, not only the current screen
- The difference between CPU core and logical processor
- 1.15 - 输入输出系统
猜你喜欢
MIT-6874-Deep Learning in the Life Sciences Week 7
4. 对象映射 - Mapping.Mapster
MySQL advanced part 2: storage engine
做 SQL 性能优化真是让人干瞪眼
1.13 - RISC/CISC
Dynamic planning solution ideas and summary (30000 words)
Is it impossible for lamda to wake up?
Open source storage is so popular, why do we insist on self-development?
Traditional databases are gradually "difficult to adapt", and cloud native databases stand out
1.14 - assembly line
随机推荐
[practical skills] technical management of managers with non-technical background
中职网络安全技能竞赛——广西区赛中间件渗透测试教程文章
The sum of the unique elements of the daily question
MySQL怎么运行的系列(八)14张图说明白MySQL事务原子性和undo日志原理
Leetcode-22: bracket generation
“磐云杯”中职网络安全技能大赛A模块新题
[rust notes] 17 concurrent (Part 1)
做 SQL 性能优化真是让人干瞪眼
4. 对象映射 - Mapping.Mapster
MySQL advanced part 2: SQL optimization
leetcode-31:下一个排列
Groupbykey() and reducebykey() and combinebykey() in spark
MySQL advanced part 2: optimizing SQL steps
【Rust 笔记】13-迭代器(中)
Daily question 1984 Minimum difference in student scores
1.15 - 输入输出系统
In depth analysis of for (VaR I = 0; I < 5; i++) {settimeout (() => console.log (I), 1000)}
Shutter web hardware keyboard monitoring
Basic explanation of typescript
Traditional databases are gradually "difficult to adapt", and cloud native databases stand out