当前位置:网站首页>冒泡排序数组
冒泡排序数组
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");
}
}
}
结果
边栏推荐
- [pytorch learning notes] tensor
- 横向越权与纵向越权[通俗易懂]
- Golang:[]byte to string
- Binary operation
- SIFT feature point extraction "suggestions collection"
- MySQL advanced learning summary 7: MySQL data structure - Comparison of hash index, AVL tree, B tree and b+ tree
- Which video recording software is better for the computer
- 数据降维——主成分分析
- FastDFS安装
- 论文导读 | 机器学习在数据库基数估计中的应用
猜你喜欢
IEDA refactor的用法
[100 cases of JVM tuning practice] 02 - five cases of virtual machine stack and local method stack tuning
Advanced performance test series "24. Execute SQL script through JDBC"
注解开发方式下AutowiredAnnotationBeanPostProcessor的注册时机
xml开发方式下AutowiredAnnotationBeanPostProcessor的注册时机
[论文阅读] CA-Net: Leveraging Contextual Features for Lung Cancer Prediction
PHP parser badminton reservation applet development requires online system
Data dimensionality reduction principal component analysis
Transformation of thinking consciousness is the key to the success or failure of digital transformation of construction enterprises
线程应用实例
随机推荐
中国信通院《数据安全产品与服务图谱》,美创科技实现四大板块全覆盖
日期工具类(不定时更新)
Advanced performance test series "24. Execute SQL script through JDBC"
Codeworks 5 questions per day (1700 average) - day 4
性能测试如何创造业务价值
Transformation of thinking consciousness is the key to the success or failure of digital transformation of construction enterprises
Learn the knowledge points of eight part essay ~ ~ 1
Use cheat engine to modify money, life and stars in Kingdom rush
C的内存管理
仿京东放大镜效果(pink老师版)
[论文阅读] CA-Net: Leveraging Contextual Features for Lung Cancer Prediction
新手必看,点击两个按钮切换至不同的内容
以太网PHY层芯片LAN8720A简介
Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径
使用CLion编译OGLPG-9th-Edition源码
Emmet basic syntax
C file input operation
How to print mybats log plug-in using XML file
PHP非对称加密方法私钥及公钥加密解密的方法
How performance testing creates business value