数据结构:队列基本操作 摘要://hh为队头,tt为队尾 int q[N],hh,tt; //插入一个数 q[++tt]=x; //删除一个 hh++; //队头元素 q[hh]; //队尾 q[tt]; //…… 文章列表 2023年07月28日 0 点赞 0 评论 202 浏览 评分:9.9
数据结构:栈 基本操作 摘要://tt表示栈顶 int stk[N],tt; //插入元素 stk[++tt]=x; //从栈顶弹出一个元素 tt--; //栈顶的值 stk[tt]; //判断栈是否为空 if(…… 文章列表 2023年07月28日 0 点赞 0 评论 206 浏览 评分:9.9
单链表(acwing) 摘要:#include<iostream> using namespace std; const int N=10010; int e[N],ne[N],idx,head; void add_to_…… 文章列表 2023年07月27日 0 点赞 0 评论 180 浏览 评分:9.9
数据结构:单链表基本操作 摘要:int e[],ne[],idx; //初始化 head =-1; idx-0; //在链表头部添加节点 void add_to_head(int x) { e[idx]=x; …… 文章列表 2023年07月27日 0 点赞 0 评论 181 浏览 评分:9.9
位运算(求n的第k位数字)(返回n的最后一位1) 摘要:求n的第k位数字#include<iostream> #include<string> using namespace std; int main(void) { int n; …… 文章列表 2023年07月26日 0 点赞 0 评论 165 浏览 评分:9.9
双指针 最长连续不重复子序列(入门) 摘要:暴力做法for(int i=0;i<n;i++) for(int j=0;j<n;j++) { if(check(i,j)) res=max(res,j-i+1) …… 文章列表 2023年07月26日 0 点赞 0 评论 180 浏览 评分:9.9
一维差分 insert初始化差分数组 insert(i,i,a[i]) 摘要:#include<iostream> using namespace std; const int N=10050; int a[N],s[N]; void insert (int l,int…… 文章列表 2023年07月26日 0 点赞 0 评论 216 浏览 评分:9.9
快速排序-简单实现 摘要:#include int a[100]; void quicksort(int left,int right) { int i, j, t, temp; // 排序终止…… 文章列表 2023年07月23日 0 点赞 0 评论 259 浏览 评分:9.0
冒泡排序-简单实现 摘要:```c #include struct Student { char name[21]; char score; }; int main() { struct…… 文章列表 2023年07月23日 0 点赞 0 评论 271 浏览 评分:9.9