教材课后习题
zhenzhenjiajia888
这个作者很懒,什么都没留下…
展开
-
98-5(进制转换)
#include #include #include using namespace std;typedef struct node{ int num; struct node* pnext;}qnode,*pnode;typedef struct stack{ pnode top; pnode botton;}qstack,*pstack;vo原创 2016-08-28 13:51:52 · 358 阅读 · 0 评论 -
16-18
#include #include using namespace std;typedef struct node{ int num; struct node* next;}NODE,*PNODE;PNODE creat_(int n)//建立循环双向链表{ int num_; PNODE head,p,q; head=(PNODE)mallo原创 2016-08-25 14:34:28 · 177 阅读 · 0 评论 -
61-16(*)
//注意(1)最小的数字可能不止一个 如 2 3 4 1 1 1 6//注意 (2)最小的数字如果在末位怎么办//注意(3)最小的数字如果在开头怎么办#include #include using namespace std;typedef struct node{ int num; struct node* next;}NODE,*PNODE;PNODE cre原创 2016-08-25 14:20:23 · 292 阅读 · 0 评论 -
61-13
//使用连续表#include #include using namespace std;typedef struct list{ int *base; int lengh; int listsize;}qlist;void creat_(qlist &list,int n){ list.base=(int*)malloc(n*sizeof(int原创 2016-08-25 12:38:36 · 211 阅读 · 0 评论 -
61-14
#include #include using namespace std;typedef struct node{ int num; struct node* prior; struct node* next;}NODE,*PNODE;PNODE creat_(int n)//建立循环双向链表{ int num_; PNODE head,p,原创 2016-08-25 12:37:46 · 226 阅读 · 0 评论 -
61-12
//使用连续表#include #include using namespace std;typedef struct list{ int *base; int lengh; int listsize;}qlist;void creat_(qlist &list,int n){ list.base=(int*)malloc(n*sizeof(int原创 2016-08-25 12:16:16 · 245 阅读 · 0 评论 -
61-11
//使用链表是因为本题需要排序#include #include using namespace std;typedef struct node{ int n; struct node* pnext;}NODE,*PNODE;PNODE creat_(int e){ int num; PNODE head,p,q; head=(PNODE)m原创 2016-08-24 21:42:59 · 254 阅读 · 0 评论 -
114-3
#include #include #define MAXSIZE 225using namespace std;typedef unsigned char SString[MAXSIZE + 1];//typdef unsigned char a[MAX_LEN]意思是定义类型unsigned char// [MAX_LEN]为a的形式void init(SString &T)//原创 2016-09-02 11:24:54 · 224 阅读 · 0 评论 -
162-15
#include #include using namespace std;int leaf=0,node=0;typedef struct bitnode{ char data; struct bitnode* lchild; struct bitnode* rchild;}bitnode,*bitree;void create(bitree &bt){原创 2016-09-13 18:11:20 · 232 阅读 · 0 评论 -
161-11
#include #include using namespace std;int l=0;char p[1000];typedef struct bitnode{ char data; struct bitnode* lchild; struct bitnode* rchild;}bitnode,*bitree;void create(bitree &bt原创 2016-09-13 17:37:32 · 168 阅读 · 0 评论 -
3.21(双向栈)
因为top0和top1都指向最后一个元素的下一个位置,所以最好不要把数组占满,如存储6个数,最好开一个7个位置的数组。#include #include using namespace std;typedef struct stack{ int* base; int top[2]; int size;}qstack,*pstack;void init(pstac原创 2016-08-30 15:32:00 · 677 阅读 · 0 评论 -
98-12
#include #include using namespace std;#define MAX 8int i=1;typedef struct node{ int num; struct node* pnext;}qnode,*pnode;pnode init(){ int i=MAX; int num_; pnode head,p,原创 2016-08-28 18:05:13 · 352 阅读 · 0 评论 -
98-10(fibonacci)
#include #include #include using namespace std;int fabonacci (int n){ int sum; if(n==1) { sum=1; } else if(n==0) { sum=0; } else if(n>1) {原创 2016-08-28 16:24:24 · 278 阅读 · 0 评论 -
98-7
({[入栈 )}]于栈顶比较#include #include #include using namespace std;typedef struct node{ char c; struct node* pnext;}qnode,*pnode;typedef struct stack{ pnode top; pnode botton;}qstac原创 2016-08-28 16:14:11 · 343 阅读 · 0 评论 -
98-6(栈-回文的使用)
#include #include #include using namespace std;typedef struct node{ char c; struct node* pnext;}qnode,*pnode;typedef struct stack{ pnode top; pnode botton;}qstack,*pstack;voi原创 2016-08-28 15:13:39 · 321 阅读 · 0 评论 -
16-20
#include #include using namespace std;typedef struct node{ int num; struct node* next; struct node* piror;}NODE,*PNODE;PNODE creat_(int n){ int num_; PNODE head,p,q; hea原创 2016-08-25 15:03:30 · 165 阅读 · 0 评论