当前位置:网站首页>Array implementation of circular linked list
Array implementation of circular linked list
2022-06-22 18:34:00 【Underwood's heart】
#include <iostream>
using namespace std;
const int N = 100010;
int m;
int e[N], l[N], r[N], idx;
// initialization ,0 yes head,1 yes tail,idx from 2 Start
void init()
{
//0 Represents the left endpoint ,1 Represents the right endpoint
r[0] = 1;
l[1] = 0;
idx = 2;
}
// In the k The value inserted after nodes is x The node of
void add(int k, int x)
{
// Change four edges , So there are four pointer operations
e[idx] = x;
l[idx]=k;
r[idx]=r[k];
l[r[k]]=idx;
r[k]=idx;
}
// Delete the first k Nodes
void remove(int k)
{
l[r[k]] = l[k];
r[l[k]] = r[k];
}
边栏推荐
- Network intelligent operation and maintenance helps improve operation and maintenance efficiency
- 使用完整功能模仿设计法
- 中国移动手机用户缓慢增长,但努力争取高利润的5G套餐用户
- The Fourth Youth Life Science Forum | first round notice
- Grafana 9 正式发布,更易用,更酷炫了!
- 新手必会的静态站点生成器——Gridsome
- SaaS application development guide
- Five practical tips for power Bi (complimentary books at the end of the article)
- [轻松学会shell编程]-4、单引号和双引号的区别、整形数值的运算、shell中数组定义和sed的详细用法
- Jenkins的安装与升级
猜你喜欢

基于转换器 (MMC) 技术和电压源转换器 (VSC) 的高压直流 (HVDC) 模型(Matlab&Simulink实现)

jsp连接MySQL总出错

Q: how bad can a programmer be?

游戏NFT市场:OpenSea最易被切下的蛋糕
![[learn shell programming easily]-4. The difference between single quotation marks and double quotation marks, the operation of integer values, the definition of arrays in the shell and the detailed us](/img/88/5d8800e5723b4e34e832271d139eaa.png)
[learn shell programming easily]-4. The difference between single quotation marks and double quotation marks, the operation of integer values, the definition of arrays in the shell and the detailed us

Nuxt - Universal (SSR / SSG) / single page app (rendering mode)

新手必会的静态站点生成器——Gridsome

Typescript (7) generic

math_ Angular function & inverse trigonometric function

When do project managers particularly want to escape from work?
随机推荐
短视频直播源码,EditText输入框的使用
Live broadcast Preview - 12 first-class Chinese scholars open ICLR 2022
Gridhome, a must-have static site generator for beginners
不断重修的计划与变化
Nuxt - 超详细环境搭建及创建项目整体流程(create-nuxt-app)
今天19:30 | 科普大佬说,带大家探寻AI如何激发人类的创造力
线程池:ThreadPoolExcutor源码阅读
Short video with goods source code, save pictures to photo album / Gallery
GPIO operation method of imx6ull
Tasks and responsibilities of the test team and basic concepts of testing
新手必会的静态站点生成器——Gridsome
I became a big enemy when I bought wanghong ice cream
Unity中通过射线躲避障碍物寻路的一些初步探索
问下 cdc 2.2.1监控sqlServer是不支持监控多库的吗?
AHA C language Chapter 6 God, a large string of numbers is approaching (lesson 26)
Pytorch——报错解决:“torch/optim/adamw.py” beta1, UnboundLocalError: local variable ‘beta1‘
静态链表(一)
docker: Error response from daemon: Conflict. The container name “/mysql“ is already in use by conta
ADAU1452开发系统界面与代码数据之间的关系
[learn shell programming easily]-4. The difference between single quotation marks and double quotation marks, the operation of integer values, the definition of arrays in the shell and the detailed us