当前位置:网站首页>JS bubble sort and select sort
JS bubble sort and select sort
2022-07-01 00:29:00 【01xm】
Bubbling
for(let i=0;i<arr.length-1;i++){
// Control the number of trips
for(let j=0;j<arr.length-i-1;j++){
// Control the number of exchanges
if(arr[j]>arr[j+1]){
var temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
choice
for(let i=0;i<arr.length;i++){
// Control the number of cycles
let k = i; // Mark , The subscript of the lowest decimal
var min = arr[k] // Let the first be the smallest number
for(let j = i+1;j<arr.length;j++){
// Find the smallest number in the sequence , use k Mark subscript
if(min>arr[j]){
min = arr[j];
k = j;
}
}
if(k!=i){
//arr[i] Is the default minimum number arr[k] Is the actual minimum number
var temp = arr[i];
arr[i] = arr[k]
arr[k] = temp;
}
}
边栏推荐
- BeanUtils. Copyproperties() vs. mapstruct
- C WinForm program interface optimization example
- lvm-snapshot:基于LVM快照的备份之准备工作
- 2022-2028 global public address fire alarm system industry research and trend analysis report
- What does it mean to open an account online? Is it safe to open an account online?
- Rhai - rust's embedded scripting engine
- 让企业数字化砸锅和IT主管背锅的软件供应链安全风险指北
- Tide - rust web framework based on async STD
- Rust book materials - yazhijia Library
- How to edit special effects in VR panorama? How to display detailed functions?
猜你喜欢

2022-2028 global mobile scanning radiology room industry survey and trend analysis report

8253A寄存器浅析

The programmer's girlfriend gave me a fatigue driving test

Makefile notes (Yiwen Institute makefile)

Solving the weird problem that the query conditions affect the value of query fields in MySQL query

20220216 misc buuctf another world WinHex, ASCII conversion flag zip file extraction and repair if you give me three days of brightness zip to rar, Morse code waveform conversion mysterious tornado br

6-1 exploit -ftp exploit
![[UML] UML class diagram](/img/6f/30bd15967103969e600d69e618d8bf.png)
[UML] UML class diagram

20220215-ctf-misc-buuctf-ningen--binwalk analysis --dd command separation --archpr brute force cracking

Wordpress blog uses volcano engine veimagex for static resource CDN acceleration (free)
随机推荐
2022-2028 global carbon fiber room scraper system industry research and trend analysis report
Techo youth 2022 academic year college open class: behind the live broadcast of Lianmai, explore how to apply audio and video technology
The difference between union and union all in MySQL
Why did kubernetes win? The changes in the container circle!
Operation record of reinitialization instance of Dameng database
A detailed explanation of the implementation principle of go Distributed Link Tracking
Basic knowledge of Embedded Network - introduction of mqtt
Matlab saves triangulation results as STL files
"Experience" my understanding of user growth "new users"
需求评审,测试人员应该发挥怎样的价值?两分钟让你不再懵逼
2022-2028 global rampant travel industry research and trend analysis report
Implementation of OSD on Hisilicon platform (1)
Don't worry about whether you can be a coder if you don't learn English well. Learn it first
20220215 CTF misc buuctf Xiaoming's safe binwalk analysis DD command separate rar file archpr brute force password cracking
Deployment of mini version message queue based on redis6.0
Detailed explanation of conv2d -- use in arrays and images
C WinForm program interface optimization example
PS2 handle-1 "recommended collection"
Basic data structure of redis
LVM snapshot: backup based on LVM snapshot