当前位置:网站首页>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;
}
}
边栏推荐
- Yboj mesh sequence [Lagrange interpolation]
- What is SRM system and how to standardize the internal procurement process of the company
- Ybtoj exchange game [tree chain splitting, line segment tree merging]
- Introduction to ES6 promise, new features of ES7 and es8 async and await
- Rhai - rust's embedded scripting engine
- LVM snapshot: backup based on LVM snapshot
- Makefile notes (Yiwen Institute makefile)
- 20220215 CTF misc buuctf the world in the mirror the use of stegsolve tool data extract
- Query points in MATLAB Delaunay triangulation
- Manage edge browser settings (ie mode, homepage binding, etc.) through group policy in the enterprise
猜你喜欢
![[untitled]](/img/96/7f26614bbdcce71006e38ee34ab216.jpg)
[untitled]

Gateway service gateway

In depth understanding of jetpack compose kernel: slottable system

Fh6908a negative pole turn off synchronous rectification analog low voltage drop diode control IC chip tsot23-6 ultra low power rectifier 1W power consumption < 100ua static replacement mp6908

2022-2028 global plant peptone industry research and trend analysis report

Detailed explanation of conv2d -- use in arrays and images

Implementation of OSD on Hisilicon platform (1)
![[NLP] [textcnn] text classification](/img/bb/c8fd9f1ed458a88a17b8d5c70d9ce2.png)
[NLP] [textcnn] text classification

20220215 CTF misc buuctf the world in the mirror the use of stegsolve tool data extract

2022-2028 global mobile scanning radiology room industry survey and trend analysis report
随机推荐
VR panorama adds contrast function to make the display of differentiation effect more intuitive!
Random ball size, random motion collision
Teach you how to use Hal library to get started -- become a lighting master
20220215 CTF misc buuctf the world in the mirror the use of stegsolve tool data extract
Development of wireless U-shaped ultrasonic electric toothbrush
Implementation of OSD on Hisilicon platform (1)
The difference between union and union all in MySQL
Combining online and offline, VR panorama is a good way to transform furniture online!
Advanced mathematical modeling
Redis - sentinel mode
IFLYTEK active competition summary! (12)
Quick start of wechat applet -- project introduction
[designmode] factory pattern
Examples of topological sequences
lvm-snapshot:基于LVM快照的备份之准备工作
Software supply chain security risk pointing North for enterprise digitalization and it executives
Redis - understand the master-slave replication mechanism
C WinForm program interface optimization example
6-1 exploit -ftp exploit
Maxpool2d explanation -- Application in arrays and images