文章分类 - 数据结构
摘要:线性表: 插入:list->data[i+1] == list->data[i]; 所有元素后移 删除: list->data[i] == liat->data[i+1];元素前移 单链表: 头插:newNode->data = data; newNode->next = *head; *head
阅读全文
摘要:第一章 数据的逻辑结构: 集合:各个元素没有其他关系; 线性结构:一对一; 树形结构:一对多; 图状结构(网状结构):多对多; 数据的物理结构(存储结构):顺序存储;链式存储;索引存储;散列存储; 数据的运算:运算的定义是针对逻辑结构的,指出运算的功能;运算的实现是针对存储结构的,指出运算的具体操作
阅读全文
摘要:1 #include <stdio.h> 2 #include <string.h> 3 4 void computeLPSArray(char* pattern, int* lps) { 5 int len = 0; // 最长前缀后缀匹配长度 6 int i = 1; 7 8 lps[0] =
阅读全文
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 4 typedef struct { 5 int* data; 6 int top; 7 int capacity; 8 } Stack; 9 10 void initialize(Stack* stack,
阅读全文
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 4 typedef struct { 5 char* data; 6 int top; 7 int capacity; 8 } Stack; 9 10 void initialize(Stack* stack,
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> // 串结构 typedef struct { char* data; int length; } String; // 初始化串 void initString(String* s
阅读全文
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 4 #define MAX_SIZE 100 5 6 // 队列结构 7 typedef struct { 8 int data[MAX_SIZE]; 9 int front; 10 int rear; 11
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #define MAX_SIZE 100 // 栈结构 typedef struct { int data[MAX_SIZE]; int top; } Stack; // 初始化栈 void initStack(Stack
阅读全文
摘要:#include <stdio.h>#include <stdlib.h> // 双向链表结点结构typedef struct Node { int data; struct Node* prev; struct Node* next;} Node; // 新建结点Node* createNode(
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> // 循环单链表节点结构 struct Node { int data; struct Node* next; // 后继节点指针 }; // 在循环单链表的尾部插入一个元素 void insertAtTail(struc
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> // 双链表节点结构 struct Node { int data; struct Node* prev; // 前驱节点指针 struct Node* next; // 后继节点指针 }; // 在双链表的头部插入一个元
阅读全文
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 4 typedef struct Node { 5 int data; 6 struct Node* next; 7 } Node; 8 9 void insertAtBeginning(Node** head
阅读全文
摘要:C语言实现顺序表的基本操作 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 #define MAX_SIZE 100 5 6 typedef struct { 7 int data[MAX_SIZE]; 8 int length; 9 } SeqList
阅读全文
浙公网安备 33010602011771号