当前位置:网站首页>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)
边栏推荐
猜你喜欢

The connection and solution between the shortest Hamilton path and the traveling salesman problem

LVS简介【暂未完成(半成品)】

Overview of variable resistors - structure, operation and different applications

leetcode-6110:网格图中递增路径的数目

MatrixDB v4.5.0 重磅发布,全新推出 MARS2 存储引擎!

RGB LED infinite mirror controlled by Arduino

MySQL怎么运行的系列(八)14张图说明白MySQL事务原子性和undo日志原理

Navicat连接Oracle数据库报错ORA-28547或ORA-03135

Traditional databases are gradually "difficult to adapt", and cloud native databases stand out

做 SQL 性能优化真是让人干瞪眼
随机推荐
【Rust 笔记】13-迭代器(下)
QQ computer version cancels escape character input expression
SQLMAP使用教程(一)
Currently clicked button and current mouse coordinates in QT judgment interface
js快速将json数据转换为url参数
Leetcode-6109: number of people who know secrets
1040 Longest Symmetric String
Daily question 2013 Detect square
Usage scenarios of golang context
Leetcode stack related
【LeetCode】Day95-有效的数独&矩阵置零
SQLMAP使用教程(二)实战技巧一
The difference between CPU core and logical processor
R language [import and export of dataset]
【Rust 笔记】13-迭代器(中)
leetcode-6108:解密消息
Introduction to LVS [unfinished (semi-finished products)]
leetcode-31:下一个排列
Is it impossible for lamda to wake up?
2022 pole technology communication arm virtual hardware accelerates the development of Internet of things software