[大师C语言(第十四篇)]C语言数据结构技术详解

引言

数据结构是计算机科学中的一个基础概念,它涉及数据组织和访问方法的设计。在C语言中,数据结构的使用可以提高程序的效率和可读性。本文将深入探讨C语言数据结构背后技术,并通过详细的代码案例,展示C语言在数据结构中的应用和优势。

第一部分:C语言数据结构基础

1.1 数据结构概述

数据结构是指数据元素之间的关系以及数据元素和数据元素之间的关系。常见的数据结构包括数组、链表、栈、队列、树和图等。这些数据结构在不同的应用场景中发挥着重要的作用。

1.2 C语言数据结构库

C语言中没有内置的数据结构库,但我们可以使用标准库中的stdlib.hstring.h等头文件来处理一些基本的数据结构,如链表、栈、队列等。此外,还可以使用第三方库,如libcsupportlibdsupport等,来支持更复杂的数据结构。

1.3 数组

数组是一种线性数据结构,它用于存储一系列相同类型的数据。数组的长度在创建时指定,不能更改。

代码案例:使用C语言数组进行数值排序

#include <stdio.h>void bubbleSort(int arr[], int n) {for (int i = 0; i < n - 1; i++) {for (int j = 0; j < n - i - 1; j++) {if (arr[j] > arr[j + 1]) {// 交换arr[j]和arr[j+1]int temp = arr[j];arr[j] = arr[j + 1];arr[j + 1] = temp;}}}
}int main() {int arr[] = {64, 34, 25, 12, 22, 11, 90};int n = sizeof(arr) / sizeof(arr[0]);bubbleSort(arr, n);printf("Sorted array: \n");for (int i = 0; i < n; i++) {printf("%d ", arr[i]);}printf("\n");return 0;
}

在这个案例中,我们首先定义了一个整数数组,并使用冒泡排序算法对其进行排序。冒泡排序是一种简单的排序算法,它通过重复地遍历要排序的数列,比较每对相邻的项目,并在必要时交换它们,直到没有再需要交换的元素为止。

1.4 链表

链表是一种线性数据结构,由一系列节点组成,每个节点包含数据域和指针域。链表的节点在内存中不是连续的,因此它比数组更加灵活。

代码案例:使用C语言链表进行数据存储

#include <stdio.h>
#include <stdlib.h>// 定义链表节点结构体
typedef struct Node {int data;struct Node* next;
} Node;// 创建链表
Node* createList() {Node* head = (Node*)malloc(sizeof(Node));head->data = 1;head->next = NULL;Node* current = head;for (int i = 2; i <= 5; i++) {Node* newNode = (Node*)malloc(sizeof(Node));newNode->data = i;newNode->next = NULL;current->next = newNode;current = newNode;}return head;
}// 打印链表
void printList(Node* head) {Node* current = head;while (current != NULL) {printf("%d ", current->data);current = current->next;}printf("\n");
}int main() {Node* head = createList();printList(head);return 0;
}

在这个案例中,我们定义了一个链表节点结构体Node,并创建了一个包含5个节点的链表。我们使用malloc函数动态分配内存来创建链表,并使用next指针来链接不同的节点。最后,我们使用printList`函数遍历链表并打印每个节点的数据。

1.5 栈

栈是一种后进先出(LIFO)的数据结构,它只允许在表的一端进行插入和删除操作。

代码案例:使用C语言栈进行后缀表达式求值

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>// 定义栈结构体
typedef struct Stack {int top;int *items;int capacity;
} Stack;// 创建栈
Stack* createStack(int capacity) {Stack* stack = (Stack*)malloc(sizeof(Stack));stack->top = -1;stack->capacity = capacity;stack->items = (int*)malloc(stack->capacity * sizeof(int));return stack;
}// 入栈
void push(Stack* stack, int item) {if (stack->top == stack->capacity - 1) {printf("Stack is full\n");return;}stack->top++;stack->items[stack->top] = item;
}// 出栈
int pop(Stack* stack) {if (stack->top == -1) {printf("Stack is empty\n");return -1;}int item = stack->items[stack->top];stack->top--;return item;
}// 后缀表达式求值
int evaluatePostfix(char* postfix) {Stack* stack = createStack(strlen(postfix));for (int i = 0; postfix[i] != '\0'; i++) {if (isdigit(postfix[i])) {push(stack, postfix[i] - '0');} else {int op1 = pop(stack);int op2 = pop(stack);switch (postfix[i]) {case '+':push(stack, op2 + op1);break;case '-':push(stack, op2 - op1);break;case '*':push(stack, op2 * op1);break;case '/':if (op2 == 0) {printf("Division by zero\n");exit(1);}push(stack, op2 / op1);break;}}}return pop(stack);
}int main() {char postfix[] = "342+*51-";printf("The result of postfix expression: %d\n", evaluatePostfix(postfix));return 0;
}

在这个案例中,我们定义了一个栈结构体Stack,并实现了createStackpushpop等函数来操作栈。我们还定义了一个evaluatePostfix函数,该函数接受一个后缀表达式字符串,并使用栈来计算表达式的值。

1.6 队列

队列是一种先进先出(FIFO)的数据结构,它允许在表的两端进行插入和删除操作。在队列中,新元素被添加到队尾,而删除操作则从队头进行。

代码案例:使用C语言队列进行任务调度

#include <stdio.h>
#include <stdlib.h>
#include <string.h>// 定义队列结构体
typedef struct Queue {int front;int rear;int *items;int capacity;
} Queue;// 创建队列
Queue* createQueue(int capacity) {Queue* queue = (Queue*)malloc(sizeof(Queue));queue->front = -1;queue->rear = -1;queue->capacity = capacity;queue->items = (int*)malloc(queue->capacity * sizeof(int));return queue;
}// 入队
void enqueue(Queue* queue, int item) {if ((queue->rear + 1) % queue->capacity == queue->front) {printf("Queue is full\n");return;}if (queue->front == -1) {queue->front = 0;}queue->rear = (queue->rear + 1) % queue->capacity;queue->items[queue->rear] = item;
}// 出队
int dequeue(Queue* queue) {if (queue->front == -1) {printf("Queue is empty\n");return -1;}int item = queue->items[queue->front];if (queue->front == queue->rear) {queue->front = -1;queue->rear = -1;} else {queue->front = (queue->front + 1) % queue->capacity;}return item;
}// 打印队列
void printQueue(Queue* queue) {if (queue->front == -1) {printf("Queue is empty\n");return;}printf("Queue: ");for (int i = queue->front; i != queue->rear; i = (i + 1) % queue->capacity) {printf("%d ", queue->items[i]);}printf("%d\n", queue->items[queue->rear]);
}int main() {Queue* queue = createQueue(5);enqueue(queue, 1);enqueue(queue, 2);enqueue(queue, 3);enqueue(queue, 4);enqueue(queue, 5);printQueue(queue);printf("Dequeued: %d\n", dequeue(queue));printQueue(queue);printf("Dequeued: %d\n", dequeue(queue));printQueue(queue);return 0;
}

在这个案例中,我们定义了一个队列结构体Queue,并实现了createQueueenqueuedequeueprintQueue等函数来操作队列。我们还定义了一个main函数,该函数演示了如何使用队列进行任务调度,并打印队列的状态。

总结

第一部分介绍了C语言数据结构的基础知识,包括数据结构概述、C语言数据结构库、数组、链表、栈、队列等。通过这些内容,我们展示了C语言在数据结构中的基本应用和步骤。在接下来的部分,我们将进一步探讨C语言数据结构的进阶技术,以及如何利用这些技术解决实际问题。

第二部分:C语言数据结构的进阶技术

2.1 树

树是一种非线性的数据结构,由节点组成,每个节点可以有多个子节点,但每个子节点只能有一个父节点。树的主要类型包括二叉树、平衡树、红黑树等。

代码案例:使用C语言实现二叉搜索树

#include <stdio.h>
#include <stdlib.h>// 定义二叉搜索树节点结构体
typedef struct TreeNode {int data;struct TreeNode* left;struct TreeNode* right;
} TreeNode;// 创建二叉搜索树
TreeNode* createTree() {TreeNode* root = (TreeNode*)malloc(sizeof(TreeNode));root->data = 10;root->left = NULL;root->right = NULL;return root;
}// 插入节点
void insert(TreeNode* root, int data) {if (root == NULL) {TreeNode* newNode = (TreeNode*)malloc(sizeof(TreeNode));newNode->data = data;newNode->left = newNode->right = NULL;return;}if (data < root->data) {insert(root->left, data);} else if (data > root->data) {insert(root->right, data);}
}// 中序遍历
void inorder(TreeNode* root) {if (root == NULL) {return;}inorder(root->left);printf("%d ", root->data);inorder(root->right);
}int main() {TreeNode* root = createTree();insert(root, 5);insert(root, 15);insert(root, 3);insert(root, 7);insert(root, 12);insert(root, 18);printf("Inorder traversal of the constructed tree: \n");inorder(root);return 0;
}

在这个案例中,我们定义了一个二叉搜索树节点结构体TreeNode,并实现了createTreeinsertinorder等函数来操作二叉搜索树。我们还定义了一个main函数,该函数演示了如何创建二叉搜索树并执行中序遍历。

2.2 图

图是一种非线性的数据结构,由节点(顶点)和边组成,用于表示实体及其之间的关系。图的主要类型包括无向图、有向图、加权图等。在C语言中,图通常使用邻接矩阵或邻接表来表示。

代码案例:使用C语言实现图的邻接表表示

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>// 定义图的邻接表表示
typedef struct Graph {int V;int E;struct AdjListNode* *adjList;
} Graph;// 定义邻接表节点的结构体
typedef struct AdjListNode {int dest;struct AdjListNode* next;
} AdjListNode;// 创建图
Graph* createGraph(int V) {Graph* graph = (Graph*)malloc(sizeof(Graph));graph->V = V;graph->E = 0;graph->adjList = (AdjListNode**)malloc(V * sizeof(AdjListNode*));for (int i = 0; i < V; i++) {graph->adjList[i] = NULL;}return graph;
}// 添加边
void addEdge(Graph* graph, int v, int w) {AdjListNode* newNode = (AdjListNode*)malloc(sizeof(AdjListNode));newNode->dest = w;newNode->next = graph->adjList[v];graph->adjList[v] = newNode;// 如果图是有向图,还需要添加反向边if (graph->E != 0) {graph->adjList[w] = (AdjListNode*)malloc(sizeof(AdjListNode));graph->adjList[w]->dest = v;graph->adjList[w]->next = NULL;}graph->E++;
}// 打印图的邻接表
void printGraph(Graph* graph) {for (int i = 0; i < graph->V; i++) {printf("Adjacency list of vertex %d \n", i);AdjListNode* pCrawl = graph->adjList[i];while (pCrawl) {printf("%d \n", pCrawl->dest);pCrawl = pCrawl->next;}}
}int main() {Graph* graph = createGraph(4);addEdge(graph, 0, 1);addEdge(graph, 0, 2);addEdge(graph, 1, 2);addEdge(graph, 2, 0);addEdge(graph, 2, 3);addEdge(graph, 3, 3);printGraph(graph);return 0;
}

在这个案例中,我们定义了一个图的结构体Graph,其中包含一个指向邻接表的指针adjList。我们还定义了一个邻接表节点的结构体AdjListNode,用于存储图中的边。我们实现了createGraphaddEdgeprintGraph等函数来操作图。我们还定义了一个main函数,该函数演示了如何创建图的邻接表表示,并打印图的结构。

总结

第二部分介绍了C语言数据结构的进阶技术,包括树和图。通过这些内容,我们展示了C语言在数据结构中的高级应用和步骤。在接下来的部分,我们将进一步探讨C语言数据结构的高级主题和应用,以及如何利用这些技术解决实际问题。

第三部分:C语言数据结构的实际应用

3.1 排序算法

排序算法是将数据集合按照一定的顺序排列的过程。C语言中的数据结构,如数组和链表,可以用来实现各种排序算法。

代码案例:使用C语言链表实现快速排序

#include <stdio.h>
#include <stdlib.h>// 定义链表节点结构体
typedef struct Node {int data;struct Node* next;
} Node;// 创建链表
Node* createList() {Node* head = (Node*)malloc(sizeof(Node));head->data = 10;head->next = NULL;Node* current = head;for (int i = 9; i >= 0; i--) {Node* newNode = (Node*)malloc(sizeof(Node));newNode->data = i;newNode->next = NULL;current->next = newNode;current = newNode;}return head;
}// 快速排序
void quickSort(Node** headRef) {Node* head = *headRef;Node* p = NULL;Node* q = NULL;Node* s = NULL;Node* temp = NULL;int pivot;if (*headRef == NULL || (*headRef)->next == NULL) {return;}// Step 1: Find the pivot element// This is done just to simplify the codep = *headRef;q = (*headRef)->next;if (q != NULL) {do {q = q->next;} while (q != NULL && q->data < p->data);}pivot = p->data;// Step 2: Re-arrange the elements// so that elements less than pivot are on the left// and elements greater than pivot are on the rights = *headRef;while (s != q) {if (s->data < pivot) {temp = s;s = s->next;} else {temp->next = q->next;q->next = s;s = temp;}}// Step 3: Recursively apply the above steps to the// left and right sub-lists*headRef = quickSort(&(q->next));q->next = quickSort(&s);return;
}int main() {Node* head = createList();printf("Original linked list \n");printList(head);quickSort(&head);printf("Sorted linked list \n");printList(head);return 0;
}

在这个案例中,我们首先创建了一个链表,并使用快速排序算法对其进行排序。快速排序是一种高效的排序算法,它通过递归地将数据分为较小和较大的两部分,然后对这两部分分别进行排序。

3.2 搜索算法

搜索算法是在数据集合中查找特定元素的过程。C语言中的数据结构,如数组和树,可以用来实现各种搜索算法。

代码案例:使用C语言二叉搜索树实现搜索操作

#include <stdio.h>
#include <stdlib.h>// 定义二叉搜索树节点结构体
typedef struct TreeNode {int data;struct TreeNode* left;struct TreeNode* right;
} TreeNode;// 创建二叉搜索树
TreeNode* createTree() {TreeNode* root = (TreeNode*)malloc(sizeof(TreeNode));root->data = 10;root->left = NULL;root->right = NULL;return root;
}// 插入节点
void insert(TreeNode* root, int data) {if (root == NULL) {TreeNode* newNode = (TreeNode*)malloc(sizeof(TreeNode));newNode->data = data;newNode->left = newNode->right = NULL;return;}if (data < root->data) {insert(root->left, data);} else if (data > root->data) {insert(root->right, data);}
}// 搜索节点
TreeNode* search(TreeNode* root, int data) {if (root == NULL) {return NULL;}if (data == root->data) {return root;}if (data < root->data) {return search(root->left, data);}return search(root->right, data);
}int main() {TreeNode* root = createTree();insert(root, 5);insert(root, 15);insert(root, 3);insert(root, 7);insert(root, 12);insert(root, 18);printf("Searching for 12 in the tree...\n");TreeNode* found = search(root, 12);if (found != NULL) {printf("Node found: %d\n", found->data);} else {printf("Node not found.\n");}return 0;
}

在这个案例中,我们定义了一个二叉搜索树节点结构体TreeNode,并实现了createTreeinsertsearch等函数来操作二叉搜索树。我们还定义了一个main函数,该函数演示了如何创建二叉搜索树并执行搜索操作。

3.3 数据库索引

数据库索引是数据结构在数据库管理中的应用之一,它通过为数据库中的表创建索引,可以显著提高查询效率。在C语言中,我们可以使用链表来模拟数据库索引的实现。

代码案例:使用C语言链表实现简单的数据库索引

#include <stdio.h>
#include <stdlib.h>// 定义链表节点结构体
typedef struct Node {int key;struct Node* next;
} Node;// 创建索引
Node* createIndex(int keys[], int n) {Node* head = (Node*)malloc(sizeof(Node));head->key = keys[0];head->next = NULL;Node* current = head;for (int i = 1; i < n; i++) {Node* newNode = (Node*)malloc(sizeof(Node));newNode->key = keys[i];newNode->next = NULL;current->next = newNode;current = newNode;}return head;
}// 搜索索引
Node* searchIndex(Node* head, int key) {Node* current = head;while (current != NULL) {if (current->key == key) {return current;}current = current->next;}return NULL;
}int main() {int keys[] = {10, 15, 3, 7, 12, 18};int n = sizeof(keys) / sizeof(keys[0]);Node* index = createIndex(keys, n);printf("Index created successfully.\n");// 搜索索引中的特定键int searchKey = 12;Node* found = searchIndex(index, searchKey);if (found != NULL) {printf("Key %d found in the index.\n", found->key);} else {printf("Key %d not found in the index.\n", searchKey);}// 释放内存Node* temp;while (index != NULL) {temp = index;index = index->next;free(temp);}return 0;
}

在这个案例中,我们定义了一个链表节点结构体Node,并实现了createIndexsearchIndex函数来操作索引。我们还定义了一个main函数,该函数演示了如何创建一个包含多个键的索引,并搜索特定键是否存在于索引中。

总结

第三部分介绍了C语言数据结构的实际应用,包括排序算法、搜索算法和数据库索引。通过这些内容,我们展示了C语言在数据结构技术在实际问题解决中的应用和步骤。在接下来的部分,我们将探讨如何利用C语言数据结构技术解决更复杂的问题,并展示一些具体的应用案例。

结语

C语言数据结构是计算机科学中的一个重要领域,它为程序员提供了高效的数据组织和访问方法。通过本文的介绍,我们希望你对C语言数据结构有了更深入的了解,并激发了进一步学习和探索的兴趣。无论你的目标是什么,C语言数据结构都将成为你实现目标的强大工具。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/18564.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Axios的使用简单说明

axios 请求方式和参数 axios 可以发送 ajax 请求&#xff0c;不同的方法可以发送不同的请求: axios.get&#xff1a;发送get请求 axios.post&#xff1a;发送post请求 axios.put&#xff1a;发送put请求 axios.delete&#xff1a;发送delete请求 无论哪种方法&#xff0c;第一…

【2】:向量与矩阵

向量 既有大小又有方向的量叫做向量 向量的模 向量的长度 单位向量 (只表示方向不表示长度) 向量的加减运算 向量求和 行向量与列向量的置换 图形学中竖着写 向量的长度计算 点乘&#xff08;计算向量间夹角&#xff09; 点乘满足的运算规律 交换律、结合律、分配…

单例模式(Java实现)

1. 懒汉式线程不安全 public class LazyUnsafeSingleton {private static LazyUnsafeSingleton singleton;private LazyUnsafeSingleton(){}public static LazyUnsafeSingleton getInstance() {if (singleton null) singleton new LazyUnsafeSingleton();return singleton;}…

MouseBoost Pro for Mac v3.4.7 鼠标右键助手 安装教程【支持M芯片】

MouseBoost Pro for Mac v3.4.7 鼠标右键助手 安装教程【支持M芯片】 原文地址&#xff1a;https://blog.csdn.net/weixin_48311847/article/details/139201501

Kibana创建ElasticSearch 用户角色

文章目录 1, ES 权限参考2, 某应用的管理员权限&#xff1a;可以open/close/delete/cat/read/write 索引3, 某应用的读写权限&#xff1a;可以cat/read/write 索引 &#xff08;不能删除索引或数据&#xff09;4, 某应用的只读权限 1, ES 权限参考 https://www.elastic.co/gui…

Notepad++不显示CRLF的方法

View -> Show Symbol -> 去掉勾选 Show All Characters

【教程】PaddleOCR高精度文字识别

转载请注明出处&#xff1a;小锋学长生活大爆炸[xfxuezhagn.cn] 如果本文帮助到了你&#xff0c;欢迎[点赞、收藏、关注]哦~ PaddleOCR/doc/doc_ch/quickstart.md at main PaddlePaddle/PaddleOCR GitHub 安装 pip install paddlepaddle -i https://mirror.baidu.com/pypi/s…

C++是微软发明的吗?为什么会有这么多的编译器?哪个才是官方的

C现在由C标准委员会维护。称作标准C。C标准委员会只是定义C的标准&#xff0c;具体的实现需要各个编译器厂商去实现&#xff0c;如微软实现的C版本为VC。Borland公司实现的是BC。各个编译器基本是遵循C标准的。仅有很小的一部分不同。 C不是微软发明&#xff0c;C是语言 但是有…

新版idea配置git步骤及项目导入

目录 git安装 下载 打开git Bash 配置全局用户名及邮箱 查看已经配置的用户名和邮箱 在IDEA中设置Git 问题解决 项目导入 git安装 下载 进入官网 Git - Downloads 点击所属本机系统&#xff0c;window如下图 选择64位安装 按照默认步骤一直下一步即可 打开git Bash …

HackTheBox-Machines--Beep

Beep测试过程 1 信息收集 nmap端口扫描 gryphonwsdl ~ % nmap -sC -sV 10.129.137.179 Starting Nmap 7.94 ( https://nmap.org ) at 2024-05-28 14:39 CST Nmap scan report for 10.129.229.183 Host is up (0.28s latency). Not shown: 988 closed tcp ports (conn-refused…

Nacos 2.x 系列【12】配置加密插件

文章目录 1. 前言2. 安装插件2.1 编译2.2 客户端2.3 服务端 3. 测试 1. 前言 为保证用户敏感配置数据的安全&#xff0c;Nacos提供了配置加密的新特性。降低了用户使用的风险&#xff0c;也不需要再对配置进行单独的加密处理。 前提条件&#xff1a; 版本:老版本暂时不兼容&…

Leetcode621. 任务调度器

Every day a Leetcode 题目来源&#xff1a;621. 任务调度器 类似题目&#xff1a;1953. 你可以工作的最大周数 解法1&#xff1a;贪心 本质上来说&#xff0c;我们需要构造一个尽量短的&#xff0c;相同元素间隔 > (n1) 的序列。 用一个数组 cnt 统计每个任务的次数。…

【御控工业物联网】 Java JSON结构转换、JSON结构重构、JSON结构互换(17):数组To对象——键值互换属性重组

文章目录 一、JSON结构转换是什么&#xff1f;二、核心构件之转换映射三、案例之《JSON数组 To JSON对象》四、代码实现五、在线转换工具六、技术资料 一、JSON结构转换是什么&#xff1f; JSON结构转换指的是将一个JSON对象或JSON数组按照一定规则进行重组、筛选、映射或转换…

介绍Django Ninja框架

文章目录 安装快速开始特性详解自动文档生成定义请求和响应模型异步支持中间件支持测试客户端 结论 Django Ninja是一个基于Python的快速API开发框架&#xff0c;它结合了Django和FastAPI的优点&#xff0c;提供了简单易用的方式来构建高性能的Web API。 安装 使用以下命令安…

CSS 介绍及用法,常用属性

一、CSS介绍 A. 简介 CSS全称&#xff1a;全称为层叠样式表&#xff08;Cascading Style Sheets&#xff09;&#xff0c;是一种用于描述网页外观和格式的计算机语言。CSS可以使网页的布局更加丰富和多样化&#xff0c;并且可以将样式信息与网页内容分离&#xff0c;使得网…

如何防止重复提交请求?

下面说的防重操作&#xff0c;如支付功能订单提交业务、表单提交、手机验证码功能。 订单提交为什么需要防重呢&#xff1f;想像一下你在商城购物&#xff0c;你选中商品点击提交订单&#xff0c;如果这时网络延迟没有返回成功提示&#xff0c;你又多点了几次。每点一次都会发送…

SpringBoot入门,idea搭建一个简单SpringBoot项目

初学者搭建一个简单的SpingBoot项目 在IntelliJ IDEA中直接创建一个新的Spring Boot项目非常直观便捷&#xff0c;下面是详细的步骤指南&#xff1a; 第1步&#xff1a;打开IntelliJ IDEA并创建新项目 打开IntelliJ IDEA。选择菜单栏的“File” > “New” > “Project”…

Github 2024-05-29 C开源项目日报 Top10

根据Github Trendings的统计,今日(2024-05-29统计)共有10个项目上榜。根据开发语言中项目的数量,汇总情况如下: 开发语言项目数量C项目10C++项目3PHP项目1PHP:流行的Web开发脚本语言 创建周期:4710 天开发语言:C, PHP协议类型:OtherStar数量:37340 个Fork数量:7657 次…

MySQL 按年月日统计,创建视图

按日统计&#xff0c;前十天 SELECTdays.day dateField,COALESCE(COUNT(archive_no), 0) AS total_quantityFROM(SELECTDATE_FORMAT(DATE_SUB(now(), INTERVAL a.a DAY), %Y-%m-%d) AS dayFROM(SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION…

003 仿muduo实现高性能服务器组件_前置知识

​&#x1f308;个人主页&#xff1a;Fan_558 &#x1f525; 系列专栏&#xff1a;仿muduo &#x1f339;关注我&#x1f4aa;&#x1f3fb;带你学更多知识 文章目录 前言时间轮timewheel设计正则表达式介绍&#xff08;了解知道怎么使用&#xff09;通用型any容器的实现 小结 …