当前位置:网站首页>数组实现循环链表
数组实现循环链表
2022-06-22 16:58:00 【安德伍德之心】
#include <iostream>
using namespace std;
const int N = 100010;
int m;
int e[N], l[N], r[N], idx;
//初始化,0是head,1是tail,idx从2开始
void init()
{
//0表示左端点,1表示右端点
r[0] = 1;
l[1] = 0;
idx = 2;
}
//在第k个结点后插入值为x的结点
void add(int k, int x)
{
//改变四条边,因此有四个指针操作
e[idx] = x;
l[idx]=k;
r[idx]=r[k];
l[r[k]]=idx;
r[k]=idx;
}
//删除第k个结点
void remove(int k)
{
l[r[k]] = l[k];
r[l[k]] = r[k];
}
边栏推荐
- 巴比特 | 元宇宙每日必读:传腾讯成立XR部门,元宇宙板块再次上涨,多家券商发报告关注虚拟人的投资机会...
- Missing value handling
- 数据库行业分析:从全球IT产业趋势到国产数据库发展之路
- What is the experience of writing a best seller
- 网络智能运维助力运维效率提升
- 新手必会的静态站点生成器——Gridsome
- Correct method of converting Inkscape into DXF file SVG exporting DXF file
- It may be the most comprehensive Matplotlib visualization tutorial in the whole network
- Noah fortune plans to land on the Hong Kong Stock Exchange: the performance fell sharply in the first quarter, and once stepped on the thunder "Chengxing case"
- The world's first AR contact lens, the entrance of metauniverse is really opened this time?
猜你喜欢

math_角函数&反三角函数

云端极简部署Svelte3聊天室

知乎热问:一个程序员的水平能差到什么程度?

Gridhome, a must-have static site generator for beginners

docker: Error response from daemon: Conflict. The container name “/mysql“ is already in use by conta

写一本畅销书是怎样的一种体验

Noah fortune plans to land on the Hong Kong Stock Exchange: the performance fell sharply in the first quarter, and once stepped on the thunder "Chengxing case"

零基础学编程/学逆向/过检测(frida实战)

Content recommendation process

国产手机干翻苹果?原来是靠百元机和猛降价实现的
随机推荐
< JVM part I: memory and garbage collection part > 08 object instantiation and direct memory
缺失值處理
High voltage direct current (HVDC) model based on converter (MMC) technology and voltage source converter (VSC) (implemented by MATLAB & Simulink)
RF Analyzer Demo搭建
[face recognition] matlab simulation of face recognition based on googlenet deep learning network
Come to Xiamen! Online communication quota free registration
Behind the fall of the first Seberg: the extreme race between technology and frostbite
各位大佬,第一次使用flink mysql cdc, 现在程序启动 没报错 新增数据没有打印出来
Short video with goods source code, save pictures to photo album / Gallery
中国移动手机用户缓慢增长,但努力争取高利润的5G套餐用户
Live broadcast Preview - 12 first-class Chinese scholars open ICLR 2022
Five practical tips for power Bi (complimentary books at the end of the article)
Beijing restorer's half moon: how to rekindle the fireworks in store management
RSPS2022 Finalist | Dr. Yang Bai 简介
【工具】pip和conda的相关使用
You guys, the first time you used flick MySQL CDC, now the program starts without error, and the new data is not printed out
如何做好研发效能度量及指标选取
Graduation season · undergraduate graduation thoughts -- the self-help road of mechanical er
math_角函数&反三角函数
Live streaming: dongyuhui is so popular. Is there anyone watching liuzhenhong?