当前位置:网站首页>冒泡排序函数封装
冒泡排序函数封装
2022-08-02 00:13:00 【Slxa 安.】
目录
1.js代码
function maoPao(arr){
for(i=0;i<=arr.length;i++){
for(j=0;j<=arr.length;j++){
if(arr[j]>arr[j+1]){
var temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
return arr;
}
result=maoPao([3,5,6,2]);
console.log(result);2.运行结果

边栏推荐
- go语言标准库fmt包怎么使用
- Play NFT summer: this collection of tools is worth collecting
- Statement执行update语句
- Graphical LeetCode - 1161. Maximum Sum of In-Layer Elements (Difficulty: Moderate)
- 一文概览最实用的 DeFi 工具
- PHP从txt文件中读取数据的方法
- An interesting project--Folder comparison tool (1)
- JSP 如何获取request对象中的路径信息呢?
- 短视频SEO搜索运营获客系统功能介绍
- How does JSP use the page command to make the JSP file support Chinese encoding?
猜你喜欢
随机推荐
字符串分割函数strtok练习
JSP out.write()方法具有什么功能呢?
Looking back at 5 recessionary times in history: How might this time be different?
ICML 2022 || 局部增强图神经网络GNN,在 GCN 和 GAT基础上 平均提高了 3.4% 和 1.6%
辨析内存函数memset、memcmp、memmove以及memcpy
07-SDRAM: FIFO control module
2022/08/01 学习笔记 (day21) 泛型和枚举
回顾历史5次经济衰退时期:这一次可能会有何不同?
当奈飞的NFT忘记了Web2的业务安全
【解决】win10下emqx启动报错Unable to load emulator DLL、node.db_role = EMQX_NODE__DB_ROLE = core
使用jOOQ将Oracle风格的隐式连接自动转换为ANSI JOIN
众筹DAO“枯萎”的缩影:曾拍下《沙丘》未出版手稿的Spice DAO解散
CVPR 2022 | SharpContour:一种基于轮廓变形 实现高效准确实例分割的边缘细化方法
Disk and file system management
632. 最小区间
PHP to read data from TXT file
BGP first experiment
Business test how to avoid missing?
JSP内置对象out对象的功能简介说明
poker question








