08 2023 档案
摘要:## bind ### 1. 介绍 bind 可以改变函数的形态,可以将一个函数改变成另一个函数的样式,但只能减少原函数的参数个数,不能增加。 ```cpp 如此处,int add(int, int), 使用bind可以绑定成一个 f 形式,原来的add的两个参数以10,20填入。bind的第一个参
阅读全文
摘要:堆是以二叉树为结构组成的一个序列,一般以数组进行实现,如设 N = 1 为根节点,则左节点 `2*N`,右节点 `2*N+1`,以此构建一整个堆。 ## 堆结构体的数据结构 ```c typedef int Item; typedef struct maxHeap { Item* data; //
阅读全文
摘要:## 选择排序 ```c 指针表示法 void choose_sort(int* arr, int n) { for (int i = 0; i 0;i--){ for(int j=0;j arr[j+1]){ swap(arr,j,j+1); } } } } ``` ## 模板(泛型) ```cp
阅读全文
摘要:```c /* * * Copyright (C) 2023-08-18 13:51 zxinlog * */ #include #define N 1000 // 普通Node typedef struct Node { int key; int value; struct Node *prev;
阅读全文
摘要:```c /* * * Copyright (C) 2023-08-16 14:22 zxinlog * */ #include // 定义结构体 typedef struct vector { int *start; int *finish; int *end_of_storage; } Vect
阅读全文
摘要:# IO 多路复用模型 ## 1. select 为了能够完成IO多路复用机制,可选用 select 函数。 nfds 所监听的最大的文件描述符+1(用来限定范围) fd_set 文件描述符集合 timeout 超时时间 FD_ZERO 清空监听队列,初始化 FD_SET 加入一个 fd 到 fds
阅读全文
摘要:### MutexLock.h ```cpp /* * MutexLock.h * Copyright (C) 2023 zxinlog * * Distributed under terms of the MIT license. */ #ifndef __MUTEXLOCK_H__ #defin
阅读全文