当前位置:网站首页>Eight sorts ----------- bubble sort
Eight sorts ----------- bubble sort
2022-07-29 06:18:00 【Plum juice】

The specific process of bubble sorting Such as gif chart With two pointers Sort one by one In this way, the largest value is obtained every time and placed on the right
public static void main(String[] args) {
int[] arr = {88,66,77,99,33,22};
Sort(arr);
System.out.println(" The result after sorting : "+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;
}
}
}
}
边栏推荐
猜你喜欢

Eight sorts --------- quick sort

Huawei cloud 14 day Hongmeng device development -day7wifi function development

LoRa开启物联网新时代-ASR6500S、ASR6501/6502、ASR6505、ASR6601

基于wifi的温度采集与控制系统

CS5340国产替代DP5340多比特音频 A/D 转换器

markdown与Typora

【软件工程之美 - 专栏笔记】29 | 自动化测试:如何把Bug杀死在摇篮里?

智慧能源管理系统解决方案

2022 spring recruit - Hesai technology FPGA technology post (one or two sides, collected from: Digital IC workers and FPGA Explorers)

基于51单片机ADC0808的proteus仿真
随机推荐
基于wifi的温度采集与控制系统
【软件工程之美 - 专栏笔记】13 | 白天开会,加班写代码的节奏怎么破?
防爆倾角传感器应用于LNG液化天然气安全作业
LeetCode #167.两数之和 II - 输入有序数组
leetcode刷题笔记 452. Minimum Number of Arrows to Burst Balloons (Medium) 452.用最少数量的箭引爆气球(中等)
scanBasePackages扫包范围配置
【软件工程之美 - 专栏笔记】26 | 持续交付:如何做到随时发布新版本到生产环境?
SQLyog 安装和配置教程
JUC collection class is unsafe
太原市公交路线爬取
【RoboMaster】从零开始控制RM电机(2)-CAN通信原理及电调通信协议
单链表面试题
【软件工程之美 - 专栏笔记】14 | 项目管理工具:一切管理问题,都应思考能否通过工具解决
Hal library learning notes-14 ADC and DAC
八大排序-----------------堆排序
Based on STM32: couple interactive doll (design scheme + source code +3d drawing +ad circuit)
基于51单片机的直流电机调速系统(L298的使用)
NRF52832-QFAA 蓝牙无线芯片
【软件工程之美 - 专栏笔记】16 | 怎样才能写好项目文档?
mavan中的plugin位置