当前位置:网站首页>Insertion Sort in Classic Sort
Insertion Sort in Classic Sort
2022-07-30 07:13:00 【Yin Pinghua】
//Increment
void asc_insert_sort(int arr[], int len)
{
int i, j;
for (i=1;i
for (j=i;arr[j-1]>temp&&j>0;j--){
arr[j] = arr[j - 1];
}
arr[j] = temp;
}
} }
}
//Decrement
void desc_insert_sort(int arr[], int len)
{
int i, j;
for (i = 1;i < len;i++) {
if (arr[i] > arr[i - 1]) {
int temp = arr[i];
for (j = i;arr[j - 1] < temp && j> 0;j--) {
arr[j] = arr[j - 1];
}
arr[j] = temp;
}
} }
}
边栏推荐
- 十七、Kotlin进阶学习:1、守护线程;2、线程和协程之间的效率对比;3、取消协程;
- 函数的信息传递(C语言实践)
- 用户密码加密编码使用 Bcrypt 代替 MD5,SHA1和SHA256
- CLUE模型构建方法、模型验证及土地利用变化情景预测
- MATLAB怎么在图像中显示nii文件切片信息?
- MySQL data types and footprint
- 抽象工厂模式(Swift 实现)
- 逻辑右移和算术右移区别
- 基于MATLAB 2021b的机器学习、深度学习
- Simulation of Future Air Pollution Changes Based on Global Model Comparison Program CMIP6 and Regional Climate-Chemistry Coupling Model WRF-Chem
猜你喜欢
求职准备知识点
QT连载1:readyRead()函数,数据分包不完整解决办法
Configure MMdetection environment and train
AAcell五号文档室——跨平台文件传输的小室一间一间的
Nodejs PM2 monitoring and alarm email (2)
2021-09-16 集成学习上--task1机器学习数学基础
R language application in the field of ecological environment
Rsync实现Win系统间的文件夹或数据同步
标准化(Normalization)知识点总结
QT每周技巧(1)~~~~~~~~~运行图标
随机推荐
基于全球模式比较计划CMIP6与区域气候-化学耦合模式 WRF-Chem 的未来大气污染变化模拟
MySQL special statement and optimizer
QT每周技巧(2)~~~~~~~~~界面按钮
Rsync realizes folder or data synchronization between Win systems
无人机生态环境监测、图像处理与GIS数据分析
OpenCV中(rows,cols)与图像(x,y)
【江科大自化协stm32F103c8t6】笔记之【入门32单片机及TIM定时中断初始化参数配置】
Atmospheric particulate matter PMF source analysis
Self-augmented Unpaired Image Dehazing via Density and Depth Decomposition程序运行记录
十二、Kotlin进阶学习:一、Lambda 表达式;二、高阶函数;
CPU的三种工作模式:实模式、保护模式、长模式
十四、Kotlin进阶学习:一、内联函数 inline;二、泛型;三、泛型约束;四、子类与子类型;
边境的悍匪—机器学习实战:第九章 无监督学习任务
七、Kotlin基础学习:1、创建类;2、构造函数;3、继承;4、封装;5、抽象类;6、接口;7、嵌套类;8、内部类;9、枚举类
基于OpenCV的相机标定流程
高效插入map数据
边境的悍匪—机器学习实战:第十一章 训练深度神经网络
[Getting C language from zero basis - navigation summary]
Twenty-two, Kotlin advanced learning: simply learn RecyclerView to achieve list display;
QT串口和CAN数据动态实时显示最后日志