- 博客(11)
- 收藏
- 关注
原创 选择第k个最小元素递归法
#include #includeusing namespace std; int Partition(int A[], int low, int high);int SelectionRec(int A[], int low, int high, int k){ if(low <= high) { int pivot = Partition(A, low,
2010-04-28 22:09:00
524
原创 选择第k个最小元素非递归法
#include #includeusing namespace std; int Partition(int A[], int low, int high);int Selection(int A[], int low, int high, int k){ int pivot_key, pivot; int l,h; while(low { l = low; h = high; pi
2010-04-28 22:09:00
412
转载 the secret of starting conversations and making friends
The secret to starting conversations and making friends rests on four key principles:1. Take the initiative and reach out to others2. Show genuine interest in people3. Treat ot
2010-04-25 19:25:00
447
原创 快速排序 以第一个元素为中轴 在小于10个元素时转为直接插入排序 并测试1000000个整形元素的速度
#include #includeusing namespace std; int Partition(int A[], int l, int r);void QSort(int A[], int l, int r);void SelectionSort(int A[], int l, int r);void QuickSort(int A[], int N){ QSort(A, 0, N
2010-04-25 15:24:00
442
原创 快速排序 以第一个,中间,最后元素的平均值为中轴 并测试1000000个整形元素的速度
#include #includeusing namespace std; int Partition(int A[], int l, int r);void QSort(int A[], int l, int r);void QuickSort(int A[], int N){ QSort(A, 0, N-1);}void QSort(int A[], int l, int r){
2010-04-25 11:56:00
1216
原创 快速排序 以第一个元素为中轴 并测试1000000个整形元素的速度
#include #includeusing namespace std; int Partition(int A[], int l, int r);void QSort(int A[], int l, int r);void QuickSort(int A[], int N){ QSort(A, 0, N-1);}void QSort(int A[], int l, int r){
2010-04-25 11:22:00
534
转载 英语五种基本句型 及如何区分双宾语和宾语补足语
英语五种基本句型 如下: 基本句型一: S +V (主+谓)例:Time flies.I work.They work for half an hour. 基本句型二: S +V +P (主+系+表)例:Everything looks different.This is an English dictionary.
2010-04-25 10:16:00
2002
原创 冒泡排序 并测试100000个整数的排序时间
#include #includeusing namespace std; void BubbleSort(int A[], int n){ for(int i=0; i { for(int j=0; j { if(A[j+1] { swap(A[j+1],A[j]); } } }}int main(){ long const N = 100000; int A[
2010-04-24 23:55:00
3869
原创 选择排序 并测试100000数的排序时间
#include #includeusing namespace std; void SelectionSort(int A[], int n){ int min = 0; for(int i=0; i { min = i; for(int j=i+1; j { if(A[j] { min = j; } } swap(A[i], A[min]); }}int
2010-04-24 23:12:00
2876
1
转载 C++中计算程序的运行时间
C++中的计时函数是clock(),而与其相关的数据类型是clock_t(头文件是time.h)。函数定义原型为:clock_t clock(void); 这个函数返回从“开启这个程序进程”到“程序中调用clock()函数”时之间的CPU时钟计时单元(clock tick)数,在MSDN中称之为挂钟时间(wal-clock)。 其中clock_t是用来保存时间的
2010-04-24 23:05:00
308
原创 如何将折半查找应用于范围查找?
如何将折半查找应用于范围查找?范围查找就是对于一个有序的数组,找出位于给定值L,U之间(包含L,U)的所有元素,L #include using namespace std; int BinarySearchL(int a[],int b,int e,int k);int BinarySearchR(int a[],int b,int e,int k);void RangeB
2010-04-23 22:16:00
1331
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人