2010年10月29日

快速排序算法

摘要: #include "stdafx.h"#include "stdlib.h"#include "stdio.h"#include "time.h"#include "math.h"int partion(int a[],int low ,int high){int pivotkey=a[low];while(low<high){while(low<high && a[high]>=pivotkey){high--;} a[low]=a[high]; //比piv 阅读全文

posted @ 2010-10-29 19:45 IT@民工 阅读(169) 评论(0) 推荐(0) 编辑

建立有序链表算法

摘要: #include "stdafx.h"#include "stdlib.h"typedef struct Node{ int data;Node* next;};void insert(Node *s ,Node *a){Node *p,*q;p=NULL;q=NULL;p=s;if(p->next==NULL) //空链表{ p->next=a; //a->next已经是NULL s->data=s->data+1; return;}q=p;p=p->next ; //链表非空,指向第一个节点while((p!=NU 阅读全文

posted @ 2010-10-29 12:06 IT@民工 阅读(227) 评论(0) 推荐(0) 编辑

导航