- 博客(8)
- 收藏
- 关注
原创 数据结构作业 队列
#include <stdio.h> #include <stdlib.h> #include <assert.h> // 队列的节点 struct Node { int data; struct Node* next; }; // 队首队尾指针 struct Queue { struct Node* front; struct Node* rear; int size; }; void Q...
2021-11-19 09:26:55
579
原创 数据结构作业 栈的操作
#include<stdio.h> #include<stdlib.h> #define OK 1 #define ERROR -1 #define MAXSIZE 10 typedef int Status; typedef struct Node{ int data; //结点的数据域 struct Node *next;//结点的指针域 int stacksize; }Node,*LinkList; int i=0;//记录栈中...
2021-11-19 09:24:32
1374
原创 数据结构作业 单链表
/* Project: single linkeed list (数据结构 单链表) Date: 2021-10-7 09:26:57 Author: Frank Wang InitList(LinkList &L) 参数:单链表L 功能:初始化 时间复杂度 O(1) ListLength(LinkList L) 参数:单链表L 功能:获得单链表长度 时间复杂度O(n) ListInsert(Li...
2021-11-19 09:23:15
318
原创 数据结构作业 KMP算法
#include<stdio.h> #include<stdlib.h> #include<string.h> char s[100],q[100]; int n,m; int next[100]; int nextval[100]; void getnext(char q[]) { int i=1;next[1]=0;int j=0; while(i<strlen(q+1)) {0 if(j==...
2021-11-19 09:21:34
317
原创 数据结构作业 蛇形填数123
1 #include<bits/stdc++.h> using namespace std; //在n*n方阵里填入1,2,3,…,n*n,要求填成蛇形。 #define N 1000 int a[N][N]; int main() { int n; cin >> n ; int x=0,y=n-1,num=0; a[x][y] = ++num; while(num<n*n) { while(x<...
2021-11-19 09:20:40
470
原创 数据结构作业 哈夫曼树
/*示例 ****哈夫曼编码**** 请输入结点个数:8 输入这8个元素的权值(均为整形): 1:27 2:4 3:87 4:21 5:2 6:21 7:1 8:25 */ #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { unsigned int weight; //用来存储各个结点的权值 unsigned int parent,LChild,RChild...
2021-11-19 09:19:11
312
原创 数据结构作业 二叉树
#include <bits/stdc++.h> //万能头文件 //FCA##DB###EH##GM### using namespace std;//分配空间 typedef struct TNode//定义二叉树的结构体 { char data; int quan; int LTag,RTag; struct TNode *lchild,*rchild; }DogEgg,*DogSon;//给结构体起的名字 DogSon pre;//线索用全局变量 D...
2021-11-19 09:18:13
905
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅