- 博客(7)
- 资源 (1)
- 收藏
- 关注
原创 汉诺塔
#include#includevoid move(char x,char y){ printf("%c-->%c/n",x,y);}void hanoi(int n,char a,char b,char c){ if(n==1) move(a,c); else { hanoi(n-1,a,c,b); move(a,c); hanoi(n-1,b,a,c); }}void step(int
2009-11-27 18:45:00
372
原创 二叉树的实现
#include#includetypedef struct bintree{ int data; struct bintree *lchild,*rchild;}BTN,*BTP;//按先序创建一个二叉树BTP creatbt(){ BTP bt;int n; scanf("%d",&n); if(n) { bt=(BTP)malloc(sizeof(BTN)); bt->data=n;
2009-11-27 18:43:00
491
原创 稀疏矩阵的实现
#define M 500typedef struct{ int i,j; int e;}TR;typedef struct{ TR data[M+1]; int mu,nu,tu;}TS;TS creatsm(){ TS sm;int n; printf("请依次键入稀疏矩阵的行、列数,非零元个数:"); scanf("%d%d%d",&sm.mu,&sm.nu,&sm.tu); for
2009-11-27 18:40:00
468
原创 队列的实现
#include#include#includetypedef struct qnode{ int data; struct qnode *next;}QN,*QP;typedef struct{ QP front; QP rear;}LQ;//建立空队列LQ initq(){ LQ q; q.front=q.rear=(QP)malloc(sizeof(QN)); if(!q.front)
2009-11-27 18:38:00
348
原创 多项式相加
#include#include#includetypedef struct polyn{ int coef; int expn; struct polyn *next;}POL;/*建立有序多项式*/POL *creatpolyn(){ POL *head,*cfront,*cnew,*clast; head=(POL *)malloc(sizeof(POL)); head->next=NULL
2009-11-27 18:36:00
488
原创 栈的实现
#include#include#includetypedef struct stack{ int data; struct stack *next;}STA;//建立栈STA *creatstack(){ STA *chead,*clast,*cnew; chead=(STA *)malloc(sizeof(STA)); chead->next=NULL; clast=chead; cnew=(
2009-11-27 18:33:00
609
原创 链表
/*该程序是用来进行链表相关操作的*//*经过Visual C++ 6.0调试*/#include#include#includetypedef struct student{ int data; struct student *next;}STU;/*建立无序链表*/STU *creatlist1(){ STU *chead,*clast,*cnew;int n=1; chead=(STU *)
2009-11-01 11:42:00
365
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人