当前位置:网站首页>Bubble sort array
Bubble sort array
2022-07-02 19:28:00 【Zhangmingming】
Start learning JAVA 了 , With C At first, it's easy to build the foundation of ,4 I learned a little in August , Later, all kinds of things failed to persist , Forget it, it's . Take your time !
Just brush to the array , Dare not jump , Afraid to miss something important !
Bubble sort !!!
public class arraysort {
public static void main(String[] args) {
int[] arr={
12,3,43,35,45,656,76,789,987,4543,311};
int temp=0;
for(int i=0;i<arr.length-1;i++){
for(int j=0;j<arr.length-i-1;j++){
if(arr[j]>arr[j+1]){
temp=arr[j+1];
arr[j+1]=arr[j];
arr[j]=temp;
}
}
}
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i]+"\t");
}
}
}
result
边栏推荐
- Virtual machine initialization script, virtual machine mutual secret key free
- PHP-Parser羽毛球预约小程序开发require线上系统
- PHP非对称加密方法私钥及公钥加密解密的方法
- 9D电影是怎样的?(+维度空间常识)
- Reading notes of code neatness
- Date tool class (updated from time to time)
- Emmet basic syntax
- High frequency interview questions
- 电脑使用哪个录制视频软件比较好
- [100 cases of JVM tuning practice] 01 - introduction of JVM and program counter
猜你喜欢

仿京东放大镜效果(pink老师版)

Use cheat engine to modify money, life and stars in Kingdom rush

消息队列消息丢失和消息重复发送的处理策略

守望先锋世界观架构 ——(一款好的游戏是怎么来的)

Talk about the design of red envelope activities in e-commerce system

云呐|为什么要用固定资产管理系统,怎么启用固定资产管理系统

高频面试题

Tutoriel (5.0) 10. Dépannage * fortiedr * fortinet Network Security expert NSE 5

Chic Lang: completely solve the problem of markdown pictures - no need to upload pictures - no need to network - there is no lack of pictures forwarded to others

zabbix5客户端安装和配置
随机推荐
Emmet基础语法
Develop fixed asset management system, what voice is used to develop fixed asset management system
What is the MySQL backup suffix_ MySQL backup restore
[test development] takes you to know what software testing is
Qpropertyanimation use and toast case list in QT
A4988 drive stepper motor "recommended collection"
ICDE 2023|TKDE Poster Session(CFP)
[error record] problems related to the installation of the shuttle environment (follow-up error handling after executing the shuttle doctor command)
Hospital online inquiry source code hospital video inquiry source code hospital applet source code
Imitation Jingdong magnifying glass effect (pink teacher version)
In pytorch function__ call__ And forward functions
Compile oglpg-9th-edition source code with clion
虚拟机初始化脚本, 虚拟机相互免秘钥
ICDE 2023|TKDE Poster Session(CFP)
Typescript 之 快速入门
Excel finds the same value in a column, deletes the row or replaces it with a blank value
Markdown basic grammar
C file input operation
IEDA refactor的用法
Processing strategy of message queue message loss and repeated message sending