Login
Discover
Waves
Decks
Plus
Login
Signup
Topics
New
Trending
Hot
New
New
Trending
Hot
New
Payouts
Muted
Promoted
Global
Top communities
Create decentralized community
latest #arigolrthy created topics on internet
franklei
bubble
2019-03-19 03:40
为面试做准备:冒泡算法
冒泡排序是排序算法中较为简单的一种,英文称为Bubble Sort。它遍历所有的数据,每次对相邻元素进行两两比较,如果顺序和预先规定的顺序不一致,则进行位置交换;这样一次遍历会将最大或最小的数据上浮到顶端,之后再重复同样的操作,直到所有的数据有序。 第一种:直接全部遍历 #include <stdio.h> int main() { int data[10]={1,3,5,7,9,2,4,6,8,0};
$ 0.000
0
1