
Data Structure
文章平均质量分 77
mci2004
i on my way!
展开
-
数据结构——判断单链表是否有环
#include #include #include #define INSERT_NUM 100#define FAST_POINT_STEP 2typedef int ElemType;typedef struct LNode{ ElemType data; struct LNode *next;}LinkList, *pNode;原创 2012-04-13 18:04:25 · 1320 阅读 · 0 评论 -
C语言,简单栈的实现 Stack
/*implement a stack in c*/#define STACK_INIT_SIZE 10#define STACK_INCREMENT 2#include #include #include typedef int ElemType;typedef int Status;typedef struct SqStack{ ElemType *base;原创 2012-05-03 17:04:19 · 18803 阅读 · 2 评论 -
2 stacks implement a queue
用两个栈来模拟一个队列的,进队和出队,写的很烂,大家多批评,多给意见,谢谢了先...../**implement a stack in c*and make two stack as a queue*Date:2012.05.03*/#define STACK_INIT_SIZE 10#define STACK_INCREMENT 2#include #include原创 2012-05-06 16:09:55 · 1125 阅读 · 0 评论 -
find kth largest number in an array
在一个数组中,找出第K打的数,原本以为很简单,但是就是这么个小东西,我写了半天,唉.....好丢人阿. 大家多多指教哈.....思想是:给定的数组中,先对前K个元素进行排序,我用的是最最简单的bubble sort,然后从第K+1个元素开始,逐个和第K个元素进行比较,如果比K个元素小就不用考虑了,如果比第K个元素大,就要想办法插入进前K个元素序列中,在插入的过程中,还需要从原有的K序列原创 2012-05-07 16:21:54 · 1763 阅读 · 0 评论 -
对数组的快速排序
一个快速排序,写的不好,大家多提意见,谢谢了../* *Quick Sort For Array *Date:20120531 *Author:Alan */#include #include typedef int Status;Status InitArray(int **arr, int length) { int i;原创 2012-05-31 14:21:42 · 1059 阅读 · 0 评论