当前位置:网站首页>冒泡排序数组
冒泡排序数组
2022-07-02 18:19:00 【张 明明】
开始学JAVA了,有了C的基础刚开始挺容易的,4月份学了一点,后来各种事没能坚持,忘完了算是。慢慢来吧!
刚刷到数组,不敢跳,害怕漏掉什么重要的点!
冒泡排序!!!
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");
}
}
}
结果
边栏推荐
- Introduction to the paper | analysis and criticism of using the pre training language model as a knowledge base
- 9D电影是怎样的?(+维度空间常识)
- C的内存管理
- 中国信通院《数据安全产品与服务图谱》,美创科技实现四大板块全覆盖
- R language uses Cox of epidisplay package Display function obtains the summary statistical information of Cox regression model (risk rate HR, adjusted risk rate and its confidence interval, P value of
- ORA-01455: converting column overflows integer datatype
- Masa framework - DDD design (1)
- Introduction to the paper | application of machine learning in database cardinality estimation
- 《病人家属,请来一下》读书笔记
- Virtual machine initialization script, virtual machine mutual secret key free
猜你喜欢

Introduction to the paper | application of machine learning in database cardinality estimation

Stm32g0 USB DFU upgrade verification error -2

Usage of ieda refactor

MySQL advanced learning summary 7: MySQL data structure - Comparison of hash index, AVL tree, B tree and b+ tree

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

Mysql高级篇学习总结8:InnoDB数据存储结构页的概述、页的内部结构、行格式

Watchful pioneer world outlook Architecture - (how does a good game come from)

高级性能测试系列《24. 通过jdbc执行sql脚本》

ICDE 2023|TKDE Poster Session(CFP)

How can retail enterprises open the second growth curve under the full link digital transformation
随机推荐
思维意识转变是施工企业数字化转型成败的关键
Mysql高级篇学习总结8:InnoDB数据存储结构页的概述、页的内部结构、行格式
How to play when you travel to Bangkok for the first time? Please keep this money saving strategy
Preprocessing and preprocessing macros
Mysql高级篇学习总结7:Mysql数据结构-Hash索引、AVL树、B树、B+树的对比
[paper reading] Ca net: leveraging contextual features for lung cancer prediction
What is the MySQL backup suffix_ MySQL backup restore
R language uses lrtest function of epidisplay package to perform likelihood ratio test on multiple GLM models (logisti regression). Compare whether the performance of the two models is different, and
Masa framework - DDD design (1)
"Patient's family, please come here" reading notes
PHP asymmetric encryption method private key and public key encryption and decryption method
Web2.0 giants have deployed VC, and tiger Dao VC may become a shortcut to Web3
MySQL advanced (Advanced) SQL statement
2022编译原理期末考试 回忆版
Qpropertyanimation use and toast case list in QT
ICDE 2023|TKDE Poster Session(CFP)
Progress progress bar
ORA-01455: converting column overflows integer datatype
[error record] problems related to the installation of the shuttle environment (follow-up error handling after executing the shuttle doctor command)
Fastdfs installation