- 博客(13)
- 收藏
- 关注
原创 二叉树的基本操作
二叉树的基本操作 #include <iostream> using namespace std; typedef struct tree1{ char data; struct tree1 *lchild,*rchild; int ltag,rtag; }nodetree,*tree; typedef struct Node { tree data; struct Node *next; }Node, *pNode; pNode p
2021-11-23 22:17:00
338
1
原创 图的基本操作
无向图的邻接矩阵 #include <iostream> using namespace std; typedef struct linjiejuzhen{ char a[100]; int b[100][100]; int dian,bian; }linjie; int find1(linjie t,char x) { int i; for(i=0;i<t.dian;i++) { if(t.a[i]==x)
2021-11-22 21:38:54
557
原创 4.树的实验题
nefu树 –题目来源题目7075707870797077707670747080 7075 #include <iostream> using namespace std; typedef struct tree1{ char data; struct tree1 *lchild,*rchild; }tree; void creattree(tree* &t) { char ch; cin>>ch; if(ch=='@')
2021-11-22 15:44:31
688
原创 3.2,3.3数据结构瑞格串,广义表
nefu瑞格串,广义表 –题目来源-nefu瑞格 4944 #include<iostream> #include<string.h> using namespace std; #define defaultSize 128 class AString { private: char *ch; int curLength; int maxSize; public: AString(int sz=defaultSize); AString(const cha
2021-11-01 21:15:40
105
原创 3.1数据结构瑞格数组
nefu瑞格数组 –题目来源-nefu瑞格 4188 C 4189 A 4198 #include <stdio.h> #include <malloc.h> void LatinMatrix(int **a,int n) { // write your code here int i,j; for(i=0;i<n;i++) { a[0][i]=i+1; a[i][0]=i+1; } for
2021-10-31 19:40:53
113
原创 2.3,2.4数据结构瑞格栈与递归、队列
nefu瑞格栈与递归、队列 –题目来源-nefu瑞格 4227 #include<stdio.h> // write your code here int sum(int a[],int n) { if(n==1) return a[0]; else return sum(a,n-1)+a[n-1]; } int main() { int a[6],i; for (i=0;i<6;i++) scanf("%d", a+i);
2021-10-24 17:42:42
168
1
原创 2.1,2.2数据结构瑞格顺序栈链式栈
nefu瑞格顺序栈 –题目来源-nefu瑞格 4909 #include<iostream> using namespace std; struct Node { int data; Node *next; }; class SeqStack { private: int *array; int maxSize; int top; void stackFull(); public: SeqStack(int sz=0); void Push(const int &am
2021-10-24 17:25:33
120
原创 1.1数据结构瑞格顺序表
nefu瑞格顺序表 4882 #include<iostream> #include<stdlib.h> using namespace std; const int defaultSize = 10; class SeqList { protected: int *data; int maxSize; //表最大可容纳项数 int last; //当前表大小 public: SeqList(int sz = defaultSize); SeqList(S
2021-10-23 17:39:20
163
原创 1.3数据结构瑞格循环链表和双向链表
nefu瑞格循环链表和双向链表 4330 #include <stdio.h> #include <malloc.h> typedef struct Node { int data; struct Node *rLink; struct Node *lLink; }Node; Node *first; Node *rear; void DList() { first = (struct Node *)malloc(sizeof(struct Node));
2021-10-23 10:34:57
110
原创 1.2数据结构瑞格单链表
nefu瑞格单链表 4331 #include <stdio.h> #include <malloc.h> typedef struct Node { int data; struct Node *next; }Node; Node *first; void List() { first = (struct Node *)malloc(sizeof(struct Node)); first->next = first; } void Insert(i
2021-10-23 06:18:51
116
原创 数据结构第三章相关队列
队列 #include <iostream> using namespace std; #define maxsize 10 typedef struct queue1{ int *base; int front1; int rear; }que; bool initqueue(que &q)//循环队列的初始化 { q.base=new int[maxsize]; q.front1=q.rear=0; return true; } in
2021-10-15 21:15:10
51
原创 数据结构第三章相关栈
顺序栈 #include<iostream> using namespace std; #define maxsize 20 typedef struct zhan1{ int *base; int *top; int stacksize; }zhan; bool initstack(zhan &s)//初始化栈 { s.base=new int[maxsize]; s.top=s.base; s.stacksize=maxsize;
2021-10-15 20:25:44
67
原创 数据结构第二章相关链表
单链表 #include <iostream> using namespace std; typedef struct node{ int data; struct node *next; }list1,*list2; bool initlist(list2 &first)//链表初始化 { first=new list1; first->next=NULL; return true; } bool listinsert(list2
2021-10-15 19:41:12
136
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人