shell脚本编写希尔排序
来源:互联网 发布:mac百度云离线下载 编辑:程序博客网 时间:2024/06/05 19:47
用shell脚本一些希尔排序
#!/bin/bash#希尔排序function shell_sort(){ #获取参数,数组 echo "输入数组长度:" read size for((i = 0; i < size; ++i)) do echo "输入第$((i))个元素:" read array[i] done echo ${array[*]} #进行排序 let gsp=size while [ $gsp -gt 1 ] do let gsp=gsp/3+1 for((idx=gsp; idx<size; idx+=gsp)) do let temp=array[idx] let pos=idx-gsp #搬移元素 let back=array[pos] while [ $pos -ge 0 -a $back -gt $temp ] do let array[pos+gsp]=array[pos] let pos=pos-gsp let back=array[pos] done let array[pos+gsp]=temp done done echo ${array[*]}}shell_sort
阅读全文
0 0
- shell脚本编写希尔排序
- shell脚本实现希尔排序
- shell脚本实现希尔排序
- shell脚本实现希尔(shell)排序
- 使用shell 脚本实现 希尔排序
- 使用shell脚本实现希尔排序
- 用shell脚本实现希尔排序
- SHELL排序,希尔排序
- day18之用shell脚本实现一个希尔排序
- 希尔(Shell)排序
- shell希尔排序
- Shell Sort 希尔排序
- 希尔(shell)排序
- 希尔(shell)排序
- 希尔shell排序
- 希尔(shell)排序
- 希尔排序(Shell Sort)
- 希尔排序(Shell Sort)
- 暑假训练第5天总结
- 接口的实例化问题,多态,以及new关键字
- codeforces 837C(暴力)
- 认识AJAX
- 想家ing8.4
- shell脚本编写希尔排序
- 【NOIP2017】Day1
- hdu1272
- ios应用程序基础:Cocoa Touch框架
- 从0开始学习 GitHub 系列之【初识 GitHub】
- (2017多校训练第四场)HDU
- MIMIC数据库中数据的下载以及MATLAB读取
- Java中HashMap遍历的四种方式
- 单链表(表头结点)