
数据结构与算法
文章平均质量分 80
fushengfei
这个作者很懒,什么都没留下…
展开
-
C++遍历文件夹
C++遍历文件夹的代码如下: #include<iostream> #include<string> #include<io.h> using namespace std; void visit(string path,int layer) { ...原创 2011-06-21 20:36:24 · 141 阅读 · 0 评论 -
数据结构之链表的实现
1、顺序链表 //.h文件#define MaxSize 50typedef char ElemType;typedef struct { ElemType elem[MaxSize]; int length;}SqList;//.cpp文件void InitList(SqList *&L){ L=(SqL...原创 2011-06-22 15:26:04 · 100 阅读 · 0 评论 -
数据结构之栈的实现
1、顺序结构的栈#define MaxSize 10typedef char ElementType;typedef struct{ ElementType elem[MaxSize]; int top;}SqStack;#include "MyStackSeq.h"void InitStack(SqStack *&s){ ...原创 2011-06-22 15:33:23 · 109 阅读 · 0 评论 -
数据结构之队列的实现
1、顺序队列的实现 typedef char ElemType;typedef struct{ ElemType elem[MaxSize]; int front,rear;}SqQueue;void InitQueue(SqQueue *&q){ q=(SqQueue *)malloc(sizeof(SqQueue));...原创 2011-06-22 15:40:21 · 125 阅读 · 0 评论 -
数据结构之二叉树的实现
1、二叉树的基本运算 #define MaxSize 100typedef char ElemType;typedef struct node{ ElemType data; struct node *lchild; struct node *rchild;}BTNode;void CreateBTNode(BTNode *...原创 2011-06-22 15:57:41 · 152 阅读 · 0 评论 -
数据结构之查找的实现
1、顺序查找 #define MAXL 100typedef int KeyType;typedef char InfoType[10];typedef struct { KeyType key; InfoType data;}NodeType;typedef NodeType SeqList[MAXL];int SeqSearch(Se...原创 2011-06-22 16:13:24 · 239 阅读 · 0 评论 -
数据结构之排序的实现
1、插入排序 void InsertSort(RecType R[],int n){ int i,j,k; RecType temp; for (i=1; i<n; i++) { temp=R[i]; j=i-1; while (j>=0&&temp.key<R[j]...原创 2011-06-27 18:04:43 · 135 阅读 · 0 评论