当前位置:网站首页>Bubble sorting and Related videos
Bubble sorting and Related videos
2022-07-28 18:38:00 【p29949】
#include <stdio.h>
void bubble_sort(int arr[], int sz)
{
// Number of bubbling sortings
int i = 0;
for (i = 0; i < sz-1; i++)
{
// Bubble sort
int j = 0;
for (j = 0; j < sz-1-i; j++)
{
if (arr[j] > arr[j + 1])
{
int tmp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = tmp;
}
}
}
}
int main()
{
int arr[10] = { 1,3,5,7,9,2,4,6,8,0 };
int sz = sizeof(arr) / sizeof(arr[0]);
//0 1 2 3 4 5 6 7 8 9
// To sort the array in ascending order
// Bubble sort
// When passing parameters to an array
// It's the array name
// Array name is essentially the address of the first element of the array
// When passing on the ginseng , What is passed is the address of the first element of the array
// Then the formal parameters of the array should be pointer variables to receive
// Degradation of array names
// The array name is the address of the first element ( There is 2 Exceptions )
// Two exceptions :
//1> sizeof( Array name ), The array name represents the entire array , It calculates the size of the entire array , The unit is byte
//2> & Array name , The array name represents the entire array , Take out the address of the entire array
// besides , The array name encountered is the address of the first element of the array
bubble_sort(arr, sz);
// Print
int i = 0;
for (i = 0; i < sz; i++)
{
printf("%d ", arr[i]);
}
return 0;
} Specific and detailed videos :: bubble sort _ Bili, Bili _bilibili
https://www.bilibili.com/video/BV13J411L72U?spm_id_from=333.337.search-card.all.click&vd_source=74ebcf0e4be00bfb17ba0c2ffffba1de
边栏推荐
- GIS数据漫谈(六)— 投影坐标系统
- Application of Internet of things in smart city
- Docker搭建Mysql主从复制
- Devops in digital transformation -- flexible cooperation
- What skills do you need to master when learning software testing zero foundation?
- 苹果开发完整的苹果证书与描述文件创建流程
- 示波器参数详解
- NDK series (5): from introduction to practice, JNI explodes the liver and explains everything in detail!
- Iptables firewall port rule configuration
- 数字化转型中的DevOps——弹性合作
猜你喜欢

MySQL advanced mvcc (ultra detailed collation)

Live broadcast starrocks technology insider: low base global dictionary optimization

Ue5 gas learning notes 0.2 configuration plug-in

示波器参数详解

云容器与云原生

Introduction to advanced design system (ads) 2009 RF simulation

mysql 索引使用与优化

当Golang遇到高并发秒杀

WordPress prompt error in establishing database connection

TCP/IP详细图解
随机推荐
Go并发详解之一
频谱仪原理简介二
How to see the future development of software testing?
当Golang遇到高并发秒杀
频谱仪原理简介一
Internet intelligence, how to define the next generation network transformation
.net WCF wf4.5 state machine, bookmark and persistence
示波器探头详解
WordPress prompt error in establishing database connection
Ue5 gas learning notes 1.1 capability system component
ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)解决办法
网络RJ45接口详解
Is it really realistic that people who have not been exposed to software testing can take up their posts after two months of training?
Look at Devops construction from SRE
Performance parameters of spectrum analyzer
Random talk on GIS data (VI) - projection coordinate system
UE5 GAS 学习笔记 1.4属性集
solidity的require报错
Outdoor activities in hot weather are exquisite! Here comes the safety guide for citizens' fitness in midsummer
Docker搭建Mysql主从复制