生无涯

吾生也有涯,而知也无涯,以无涯随有涯,乐以忘忧,生亦无涯矣www.cnblogs.com/shengwuya
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

随笔分类 -  Data Structure

摘要:/***quick sort**/#include<stdio.h>void swap(int * a,int * b){int tmp;tmp = *a;*a = * b;*b = tmp;}void quickSort(int array[],int start,int end){int i,j;if(start < end){i = start;j = end + 1;wh... 阅读全文

posted @ 2010-10-21 23:49 生无涯 阅读(136) 评论(0) 推荐(0)

摘要:/***他山之石**/class stackNode{ double m_dbValue; stackNode*m_pNext; stackNode*m_pCurentmin;};class stack{stackNode*m_pTop; void push(const double v) { stackNode*p=new stackNode(); p.m_dbValue;=v; p.m_pNe... 阅读全文

posted @ 2010-10-20 23:57 生无涯 阅读(166) 评论(0) 推荐(0)

摘要:/***shell's sort**/#include<stdio.h>void shellSort(int array[],int n){int gap = n,flag = 0;int tmp,j = 0;while(gap > 1){gap /= 2;do{flag = 0; for(int i = 0;i < n - gap;i++){ j = i + gap;if... 阅读全文

posted @ 2010-10-19 23:53 生无涯 阅读(143) 评论(0) 推荐(0)

摘要:/***selection sort**/#define keyType int#include<stdio.h>int selectSort(keyType array[],int n){keyType tmp;for(int i = 0;i < n - 1;i++){int min = i;for(int j = i + 1;j < n;j++){if(array[j]... 阅读全文

posted @ 2010-10-18 00:00 生无涯 阅读(205) 评论(0) 推荐(0)

摘要:/***bubble Sort**/#define keyType int#include<stdio.h>//base bubble sort int bubbleSort(keyType array[],int n){keyType tmp;for(int i = 1;i <= n-1;i++){for(int j = 0;j < n-i;j++){if(array[j... 阅读全文

posted @ 2010-10-17 00:42 生无涯 阅读(183) 评论(0) 推荐(0)

摘要:/***Straight Insertion Sort**/#define keyType int#include<stdio.h>int insertSort(keyType array[],int n){keyType tmp;for(int i = 1;i < n;i++){tmp = array[i];int j = i -1;while(j >= 0 &&... 阅读全文

posted @ 2010-10-16 23:43 生无涯 阅读(154) 评论(0) 推荐(0)