数据结构
美好环环相扣
困难都只是暂时的,冲鸭!
展开
-
先进先出淘汰算法
// C语言实现操作系统最佳淘汰算法 #include <stdio.h> #include <stdlib.h> #define length 20//定义数组长度 int bwoList[length];//淘汰序列 void initList(int arr[]) {//生成随机访问序列 for (int i = 0; i < length; ++i)...原创 2020-05-01 18:54:50 · 1002 阅读 · 0 评论 -
C语言邻接表各种操作
代码 #include <stdio.h> #include <malloc.h> #define MVNum 100 //最大的顶点数 typedef int VerTexType; typedef struct ArcNode {//定义边节点 int adjves;//该边所指向的顶点的位置 struct ArcNode * nextarc;//指向...原创 2020-02-05 18:07:50 · 495 阅读 · 0 评论 -
C语言邻接矩阵各种操作
#include <stdio.h> #include <malloc.h> #define MAxINt 32767 //表示极大值 #define MVNUm 10 //顶点的个数 int visited[10]; typedef char VerTexType; //顶点的数据类型为字符型 typedef int ArcType; // 假设边的权值类型为整型 t...原创 2020-02-05 18:06:11 · 742 阅读 · 0 评论 -
C语言二叉树各种操作
代码 #include <stdio.h> #include <malloc.h> typedef struct BiTree { // 定义二叉树的结构体 int data;//定义二叉树的数据类型 struct BiTree *lchild, *rchild;//递归定义二叉树的左子树 右子树 } BiTNode, *BiTree; int Cr...原创 2020-02-03 15:45:42 · 1234 阅读 · 3 评论 -
c语言链栈的各种操作
链栈的实现和单链表一样,只是存取的位置不一样。 参考文章 传送门原创 2020-01-29 16:27:18 · 174 阅读 · 0 评论 -
c语言链队列的各种操作
连队列和单链表差不多,只是存取位置限定。 参考同类博文c语言单链表即可 传送门原创 2020-01-29 16:22:57 · 212 阅读 · 0 评论 -
c语言顺序栈的各种操作
代码 #include <stdio.h> #include <malloc.h> typedef struct { int *base;//基地址 int font;//头指针 int bear;//尾指针 }SqQueen; #define MAX 10 //循环顺序队列 void initQueen(SqQueen *q){//循环队列的...原创 2020-01-29 16:18:35 · 279 阅读 · 0 评论 -
c语言栈的各种操作
武汉加油!! 栈的各种操作 #include <stdio.h> #include <malloc.h> #include <string.h> #define MAX 10//栈的大小 #define INCSIZE 10 //栈满时增加内存 relloc函数 typedef struct { //定义顺序栈 int * base;//栈底指针 ...原创 2020-01-28 22:30:59 · 753 阅读 · 0 评论 -
leetcode21
将两个有序链表合并为一个新的有序链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。 示例: 输入:1->2->4, 1->3->4 输出:1->1->2->3->4->4 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/merge-two-sorted-lists 著作权归领扣网...原创 2020-01-27 17:29:57 · 311 阅读 · 0 评论 -
C语言链表各种操作
今天是大年初二,由于阿冠影响,继续学习 #include <stdio.h> #include <malloc.h> typedef struct { int age; char name[10]; }Element; typedef struct Node{ //单链表实现 Element data;//注意区别顺序表 struct...原创 2020-01-26 17:13:07 · 326 阅读 · 0 评论 -
C语言实现顺序表的各种操作
在因为阿冠得家哪儿都不能去,就把数据结构和算法复习复习 顺序表得各种操作 #include <stdio.h> #include <malloc.h> #define MAXSIZE 10 typedef struct { // 存放数据的结构体 int age; char name[20]; }student; typedef struct { ...原创 2020-01-25 22:03:38 · 433 阅读 · 0 评论