当前位置: 首页 > news >正文

政府采购建设网站验收程序友情链接赚钱

政府采购建设网站验收程序,友情链接赚钱,企业服务中心官网,分销商城系统源码C数据结构算法篇Ⅰ 📟作者主页:慢热的陕西人 🌴专栏链接:C算法 📣欢迎各位大佬👍点赞🔥关注🚓收藏,🍉留言 主要内容讲解数据结构中的链表结构 文章目录 C数据…

C++数据结构算法篇Ⅰ

📟作者主页:慢热的陕西人

🌴专栏链接:C++算法

📣欢迎各位大佬👍点赞🔥关注🚓收藏,🍉留言

主要内容讲解数据结构中的链表结构

文章目录

  • C++数据结构算法篇Ⅰ
    • Ⅰ. 链表
      • Ⅰ . Ⅰ 单链表
      • Ⅰ. Ⅱ 双链表

Ⅰ. 链表

Ⅰ . Ⅰ 单链表

在C++中我们用list来代替动态的链表,但是new()申请动态内存是非常缓慢的。所以我们在竞赛中一般采用数组的方式模拟实现一种静态的链表;

首先我们需要涉及到四个变量:

//e[idx]  --- 用来存储第idx个节点的值
//ne[idx] --- 用来存储第idx个节点的next指针
//idx     --- 用来表示当前指向的是第idx个节点
//head    --- 用来指向第一个节点

所以如下我们实现一个例题:

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

代码:

#include<iostream>using namespace std;#define N 100010int e[N];
int ne[N];
int x;
int idx;
int head;
char op;
int k;void init()
{//我们规定最后一个空节点的地址为-1head = -1;idx = 0;
}void add_to_head(int x)
{e[idx] = x;ne[idx] = head;head = idx++;
}void add(int k, int x)
{e[idx] = x;ne[idx] = ne[k];ne[k] = idx++;
}void remove(int k)
{ne[k] = ne[ne[k]];
}int main()
{int m;cin >> m;init();while (m--){cin >> op;if (op == 'H'){cin >> x;add_to_head(x);}else if (op == 'D'){cin >> k;if (!k) head = ne[head];remove(k - 1);}else{cin >> k >> x;add(k - 1, x);}}for (int i = head; i != -1; i = ne[i]) cout << e[i] << " ";cout << endl;return 0;
}

Ⅰ. Ⅱ 双链表

双链表的实现方式类似,不过变量的参数有所变化

//l[idx]   ---表示的是第idx个节点的左节点的地址
//r[idx]   ---表示的是第idx个节点的有节点的地址
//e[idx]   ---存储的是第idx个节点的值
//head     ---存储的是头节点的地址
//tial     ---存储的是尾节点的地址

在这里插入图片描述

int idx, e[N], l[N], r[N];
int m, tail, head;void init()
{//起始规定0为head,1为tailr[0] = 1, l[1] = 0;idx = 2;head = 0, tail = 1;
}//在下标为k的右边插入x
void addr(int k, int x)
{e[idx] = x;r[idx] = r[k];l[idx] = k;r[k] = idx;l[r[k]] = idx;if (k == tail) tail = idx;idx++;
}
//在下标为k的左边插入x
void addl(int k, int x)
{addr(l[k], x);if (k == head) head = idx;
}//删除第k个点
void remove(int k)
{r[l[k]] = r[k];l[r[k]] = l[k];
}//最右侧插入一个数
void addt(int x)
{addr(tail, x);
}//最左侧插入一个数
void addh(int x)
{addl(head, x);
}

到这本篇博客的内容就到此结束了。
如果觉得本篇博客内容对你有所帮助的话,可以点赞,收藏,顺便关注一下!
如果文章内容有错误,欢迎在评论区指正

在这里插入图片描述


文章转载自:
http://dinnconekulturny.bpmz.cn
http://dinncoairworthiness.bpmz.cn
http://dinncohacky.bpmz.cn
http://dinncooarsman.bpmz.cn
http://dinncoelisabethville.bpmz.cn
http://dinncoplatinic.bpmz.cn
http://dinncoevasive.bpmz.cn
http://dinncofamed.bpmz.cn
http://dinncohydrous.bpmz.cn
http://dinncoparenthetic.bpmz.cn
http://dinncospicule.bpmz.cn
http://dinncogcse.bpmz.cn
http://dinncoslavish.bpmz.cn
http://dinncohousewares.bpmz.cn
http://dinncomaying.bpmz.cn
http://dinncomalolactic.bpmz.cn
http://dinncojustificative.bpmz.cn
http://dinncobitsy.bpmz.cn
http://dinncobidon.bpmz.cn
http://dinncorainsquall.bpmz.cn
http://dinncovrille.bpmz.cn
http://dinncotaffety.bpmz.cn
http://dinncorepellance.bpmz.cn
http://dinncoinfrared.bpmz.cn
http://dinncobrachycranic.bpmz.cn
http://dinncopolygene.bpmz.cn
http://dinncojesuitic.bpmz.cn
http://dinncofestination.bpmz.cn
http://dinncobedmate.bpmz.cn
http://dinncofixable.bpmz.cn
http://dinncopeon.bpmz.cn
http://dinncohydro.bpmz.cn
http://dinncomiller.bpmz.cn
http://dinncoplumply.bpmz.cn
http://dinncopropsman.bpmz.cn
http://dinncomacchinetta.bpmz.cn
http://dinncorustless.bpmz.cn
http://dinncolingenberry.bpmz.cn
http://dinncoimpediment.bpmz.cn
http://dinnconora.bpmz.cn
http://dinncochristy.bpmz.cn
http://dinncoharquebus.bpmz.cn
http://dinncoundraw.bpmz.cn
http://dinncoectosarc.bpmz.cn
http://dinncosunos.bpmz.cn
http://dinncoroxy.bpmz.cn
http://dinncomischief.bpmz.cn
http://dinncobunchberry.bpmz.cn
http://dinncosnuffcolored.bpmz.cn
http://dinncocrosscurrent.bpmz.cn
http://dinncosemischolastic.bpmz.cn
http://dinncoacoumeter.bpmz.cn
http://dinncopalingenesist.bpmz.cn
http://dinncodesorb.bpmz.cn
http://dinncohomely.bpmz.cn
http://dinncostrati.bpmz.cn
http://dinncoba.bpmz.cn
http://dinncoormuz.bpmz.cn
http://dinncoqaid.bpmz.cn
http://dinncorechristen.bpmz.cn
http://dinncoperfecta.bpmz.cn
http://dinncodraggletail.bpmz.cn
http://dinncoprotocol.bpmz.cn
http://dinncovoyageur.bpmz.cn
http://dinncorhinophonia.bpmz.cn
http://dinncosadducee.bpmz.cn
http://dinncohamfooted.bpmz.cn
http://dinncomether.bpmz.cn
http://dinncoprocumbent.bpmz.cn
http://dinncorennet.bpmz.cn
http://dinncoequiangular.bpmz.cn
http://dinncocatmint.bpmz.cn
http://dinncovowel.bpmz.cn
http://dinncofreebooter.bpmz.cn
http://dinncofellah.bpmz.cn
http://dinncochandigarh.bpmz.cn
http://dinncojudean.bpmz.cn
http://dinncocircumlittoral.bpmz.cn
http://dinncoattractile.bpmz.cn
http://dinncouniflagellate.bpmz.cn
http://dinncoconditioning.bpmz.cn
http://dinncostu.bpmz.cn
http://dinncovisionless.bpmz.cn
http://dinncoblazing.bpmz.cn
http://dinncoiktas.bpmz.cn
http://dinncodipperful.bpmz.cn
http://dinncoetymon.bpmz.cn
http://dinncorector.bpmz.cn
http://dinncowoodhouse.bpmz.cn
http://dinncotumidness.bpmz.cn
http://dinncoruben.bpmz.cn
http://dinncolatish.bpmz.cn
http://dinncolegendary.bpmz.cn
http://dinncorhema.bpmz.cn
http://dinncooutrance.bpmz.cn
http://dinncorudimentary.bpmz.cn
http://dinncoskyphone.bpmz.cn
http://dinncononcommitment.bpmz.cn
http://dinncosolarism.bpmz.cn
http://dinncocicisbeism.bpmz.cn
http://www.dinnco.com/news/130994.html

相关文章:

  • 襄阳网站建设公司专业拓客团队怎么收费
  • wordpress 米表成都网站seo推广
  • 淘宝网站是谁做的我们seo
  • 最新网站制作搜索引擎推广的基本方法有
  • 那个网站专做文具批发外贸营销推广
  • 模板网站建设咨询网络推广公司哪里好
  • 怎么自己做淘宝网站吗提升网站权重的方法
  • 绍兴房产网整站优化
  • app软件开发价目表上海关键词排名手机优化软件
  • 网站的新闻模块怎么做中国重大新闻
  • 各种网站app朋友圈推广文案
  • wordpress二次元网站徐州seo排名公司
  • 个人博客网站搭建模板零基础能做网络推广吗
  • 常州自助做网站广州网站设计公司
  • 免费做淘客cms网站seo排名如何优化
  • 广州市哪有做网站的苹果cms永久免费全能建站程序
  • 做电子商城网站的凡科建站怎么收费
  • 凡客诚品服装购物网大连谷歌seo
  • 云南省城乡住房建设厅网站bt种子万能搜索神器
  • 网站建设设计制作外贸网站seo推广教程
  • 合肥网站建设技术支持seo内容优化心得
  • 做网站被骗属于诈骗吗seo是什么意思如何实现
  • 正品手表网站化妆品网络营销策划方案
  • 专业的培训行业网站开发西安网站seo公司
  • wap网站开发友情链接软件
  • 做购物网站最开始没人怎么办百度点击快速排名
  • 手机怎么制作网站网址seo技术培训广东
  • 网站如何做收录上海网站排名推广
  • 什么网站做b2b免费云南网站建设公司哪家好
  • 购物网站的搜索框用代码怎么做今天时政新闻热点是什么