当前位置:网站首页>八大排序----------------冒泡排序
八大排序----------------冒泡排序
2022-07-29 05:23:00 【李汁汁】

冒泡排序的具体过程 如gif图 利用双指针 进行一个一个排序 这样每次都得到第一大的值放到右面
public static void main(String[] args) {
int[] arr = {88,66,77,99,33,22};
Sort(arr);
System.out.println("排序后的结果: "+Arrays.toString(arr));
}
public static void Sort(int[] arr) {
int temp = 0;
for (int i = 0; i < arr.length-1; i++) {
for(int j=0;j<arr.length-1;j++) {
if(arr[j]>arr[j+1]) {
temp = arr[j];
arr[j] = arr[j+1];
arr[j+1]= temp;
}
}
}
}
边栏推荐
- STM32: mcnamu wheel tracking task (library function program code)
- Hal library learning notes-14 ADC and DAC
- 【软件工程之美 - 专栏笔记】27 | 软件工程师的核心竞争力是什么?(上)
- 【软件工程之美 - 专栏笔记】25 | 有哪些方法可以提高开发效率?
- 物联网倾斜监测解决方案
- SimpleFOC调参2-速度、位置控制
- 【软件工程之美 - 专栏笔记】29 | 自动化测试:如何把Bug杀死在摇篮里?
- 【RoboMaster】从零开始控制RM电机(2)-CAN通信原理及电调通信协议
- 2.4G频段的无线收发芯片 SI24R1 问题汇总解答
- Zero basics FPGA (5): counter of sequential logic circuit design (with introduction to breathing lamp experiment and simple combinational logic design)
猜你喜欢

京微齐力:基于HMEP060的心率血氧模块开发(1:FPGA发送多位指令)

Logistic regression - project practice - credit card detection task (Part 2)

【软件工程之美 - 专栏笔记】24 | 技术债务:是继续修修补补凑合着用,还是推翻重来?

倾角传感器用于通信铁塔、高压电塔长期监测

华为云14天鸿蒙设备开发-Day1环境搭建

Zero basics FPGA (5): counter of sequential logic circuit design (with introduction to breathing lamp experiment and simple combinational logic design)

FPGA based: multi-target motion detection (hand-in-hand teaching ①)

2022 spring move - core technology FPGA post technical aspects (one side experience)

避坑:关于两个HC-05主从一体蓝牙模块互连,连不上问题

基于stm32的四针OLED显示
随机推荐
智能温度控制系统
DP1332E多协议高度集成非接触式读写芯片
Transformer review + understanding
数论:px+py 不能表示的最大数为pq-p-q的证明
STM32 检测信号频率
Huawei cloud 14 day Hongmeng device development -day3 kernel development
2022春招——芯动科技FPGA岗技术面(一面心得)
QT learning notes QtSql
Tf.get in tensorflow_ Detailed explanation of variable() function
TLE5012b+STM32F103C8T6(bluepill)读取角度数据
SQLyog 安装和配置教程
Review of neural network related knowledge (pytorch)
Am model in NLP field
2022 spring move - core technology FPGA post technical aspects (one side experience)
智慧能源管理系统解决方案
Jingwei Qili: development of heart rate and blood oxygen module based on hmep060 (1: FPGA sends multi bit instructions)
八大排序-----------------堆排序
基于FPGA:多目标运动检测(手把手教学①)
FPGA based: multi-target motion detection (hand-in-hand teaching ①)
2.4G频段的无线收发芯片 SI24R1 问题汇总解答