
排序算法
文章平均质量分 68
枫继续吹
枫会继续吹
展开
-
template 冒泡排序
template 冒泡排序原创 2011-03-28 13:12:00 · 347 阅读 · 0 评论 -
C++插入排序法(Insertion Sort)
// implementation of Insertion Sort (C++)#include <iostream>using namespace std;void SwapTwo(int &a, int &b){ int temp = a; a = b; b = temp;}void InsertSort(int arr[], int size){ for (int i=1; i<size; i++) { int inser原创 2014-04-03 23:38:52 · 3030 阅读 · 0 评论 -
C++冒泡排序法 (Bubble Sort)
// implementation of Bubble Sort (C++)#include <iostream>using namespace std;void SwapTwo(int &a, int &b){ int temp = a; a = b; b = temp;}void BubbleSort(int arr[], int size){ for (int i=0; i<size; i++) { int j = size原创 2012-02-29 14:14:36 · 837 阅读 · 0 评论 -
C++ 堆排序 (HeapSort)
// HeapSort/******************************************** aim: to sort an array in ascending order. 1. making a max-heap firstly(biggest on top). using siftup function (siftdown works as well if you原创 2012-03-15 17:58:27 · 2650 阅读 · 1 评论 -
C++选择排序法(Selection Sort)
// implementation of Selection Sort (C++)#include <iostream>using namespace std;void SwapTwo(int& a, int& b){ int temp=a; a=b; b=temp;}void SelectionSort(int arr[], int size){ for (int i=0; i<size;i++) { int Smalle原创 2014-04-04 17:37:25 · 4184 阅读 · 0 评论