排序算法之冒泡排序
Posted lzjlzj
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了排序算法之冒泡排序相关的知识,希望对你有一定的参考价值。
#include <iostream> using namespace std; void swap(int &a, int &b) { int t = a; a = b; b = t; } void bbsort(int d[], int len) { for (int i = 0; i < len; i++) { for (int j = 1; j < len - 1; j++) { if (d[j - 1] > d[j]) { swap(d[j - 1], d[j]); } } } }
以上是关于排序算法之冒泡排序的主要内容,如果未能解决你的问题,请参考以下文章