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

网站建设的钱计入什么科目百度推广电话客服

网站建设的钱计入什么科目,百度推广电话客服,优化是什么意思网络用语,四川新站优化创作不易&#xff0c;本篇文章如果帮助到了你&#xff0c;还请点赞 关注支持一下♡>&#x16966;<)!! 主页专栏有更多知识&#xff0c;如有疑问欢迎大家指正讨论&#xff0c;共同进步&#xff01; &#x1f525;c语言系列专栏&#xff1a;c语言之路重点知识整合 &#x…

创作不易,本篇文章如果帮助到了你,还请点赞 关注支持一下♡>𖥦<)!!
主页专栏有更多知识,如有疑问欢迎大家指正讨论,共同进步!
🔥c语言系列专栏:c语言之路重点知识整合 🔥
给大家跳段街舞感谢支持!ጿ ኈ ቼ ዽ ጿ ኈ ቼ ዽ ጿ ኈ ቼ ዽ ጿ ኈ ቼ ዽ ጿ ኈ ቼ

在经过数组基本知识的学习后,我们知道数组可以用来存放一组数据

但是数组的个数是固定的,如果我们想动态改变这组数据,通过数组就十分麻烦

基于结构体的知识基础上,本文将介绍一种新的数据结构——链表


链表的增删改查功能完整组件化封装


链表 目录

  • 链表的基本概念
    • 步骤:
  • 添加:
  • 插入:
  • 删除:
    • 1.按下标删除
    • 2.按数据删除
  • 查找
    • 1.按下标查找返回数据
    • 2.按数据查找返回下标

链表的基本概念

根据数组长度固定的特点,我们可以将数组比作货车,货车装满了数据,添加数据只能再装一辆货车(定义一个新数组),修改数据还要删除某些已有数据,太具有局限性。

从长度固定的角度出发,我们需要一个不是长度固定,还能存放一组数据的“数据类型”,就是链表

如果说数组是货车,那链表就是火车,它可以随意地在一组数据的末端添加新数据,还可以在中间添加删除等,非常灵活,那么链表是如何定义的呢?

链表通过结构体指针实现。通常需要定义一个表示链表节点的结构体,包含两个成员:数据指向下一个节点的指针

一个链表节点的结构体定义例如:

定义节点时同时定义节点的指针,在后续堆区创建、链表遍历等都会用到
typedef struct node			//使用typedef简化命名
{int data;	//数据struct node* next;//下一个节点的 结构体指针
} Node,* P_NODE,*PNode;	//节点指针

一个链表是由多个结点连接组成,链表中的第一个节点称为头节点,最后一个节点称为尾节点

头节点通常用一个指针来保存,指向链表的第一个节点。如果链表为空,则头指针为NULL

在定义好节点的结构体后,创建一个(静态)链表的过程为:

步骤:

1.声明一个头节点,一般头节点不存贮数据

	Node header = { -1,NULL };

2.创建几个节点变量: 栈区 或 堆区

	Node n1 = { 0,NULL };Node n2 = { 6,NULL };Node n3 = { 2,NULL };Node n4 = { 2,NULL };

	P_NODE newNode = malloc(sizeof(Node));	//记得free

(堆区知识:堆区详解)

  1. 链接所有节点
	header.next= &n1;n1.next = &n2;n2.next = &n3;n3.next = &n4;n4.next = newNode;	//已经是结构体指针类型,不需要再取地址newNode->next = NULL;
  1. 遍历链表
//Node* p;P_NODE p= header.next;while (p!=NULL){printf("%d ", p->data);p=p->next;}free(newNode);

在这里插入图片描述

添加:

我们可以将添加节点封装为函数:

PNode create(int data)
{PNode newNode = (PNode)malloc(sizeof(NODE));newNode->data = data;newNode->next = NULL;return newNode;
}

在链表上添加数据,定义一个add函数,分为一开始链表为空和不为空两种情况

void add(PNode node)
{if (header == NULL){header = ender = node;}else{ender->next = node;ender=node;}}

然后先调用create函数创建节点,再使用add添加到链表: add(create(添加的数据));
在这里插入图片描述

插入:

理想的在后面插入数据

void insert_behind(int index, PNode node)
{PNode p = header;for (int i = 0; i < index; i++){p = p->next;}//保留p的下一个PNode q = p->next;node->next = q;p->next = node;
}

然后先调用create创建插入的节点,通过插入的下标插入到链表中:
在这里插入图片描述

删除:

1.按下标删除

现只考虑理想的中间删除,不考虑删头删尾:

void remove_index(int index)
{PNode p = header;PNode q;for (int i = 0; i < index; i++){q = p;p = p->next;}PNode m = p->next;q->next = m;free(p);
}

在这里插入图片描述

2.按数据删除

void remove_data(int data)
{PNode p = header;PNode q;while (p->data != data){q = p;p = p->next;}PNode m = p->next;q->next = m;free(p);}

在这里插入图片描述

查找

先写一个得到链表长度的函数:

int size()
{PNode p = header;int i=0;while (p!=NULL){i++;p = p->next;}return i;
}

在这里插入图片描述

1.按下标查找返回数据

int get(int index)
{PNode p = header;for (int i = 0; i < index; i++){p = p->next;}return p->data;
}

在这里插入图片描述

2.按数据查找返回下标

int indexOf(int data)
{int index=0;PNode p = header;while (p->data != data){index++;p = p->next;}return index;
}

在这里插入图片描述


本文全部代码(供自己调试查看):

#include <stdio.h>
#include <stdlib.h>typedef struct node
{int data;				//数据struct node *next;		//结构体指针
}NODE,*PNode;PNode create(int data);
void add(PNode node);void insert_behind(int index, PNode node);void remove_index(int index);
void remove_data(int data);int size();
int get(int index);
int indexOf(int data);PNode header = NULL;	//头尾结点的位置
PNode ender = NULL;int main()
{add(create(1));add(create(2));add(create(3));add(create(4));insert_behind(2, create(9));//remove_index(1);remove_data(9);printf("%d\n", indexOf(4));return 0;
}PNode create(int data)
{PNode newNode = (PNode)malloc(sizeof(NODE));newNode->data = data;newNode->next = NULL;return newNode;
}void add(PNode node)
{if (header == NULL){header = ender = node;}else{ender->next = node;ender=node;}}/*理想的在后面插入数据*/
void insert_behind(int index, PNode node)
{PNode p = header;for (int i = 0; i < index; i++){p = p->next;}//保留p的下一个PNode q = p->next;node->next = q;p->next = node;
}void remove_index(int index)
{PNode p = header;PNode q;for (int i = 0; i < index; i++){q = p;p = p->next;}PNode m = p->next;q->next = m;free(p);
}void remove_data(int data)
{PNode p = header;PNode q;while (p->data != data){q = p;p = p->next;}PNode m = p->next;q->next = m;free(p);}int size()
{PNode p = header;int i=0;while (p!=NULL){i++;p = p->next;}return i;
}int get(int index)
{PNode p = header;for (int i = 0; i < index; i++){p = p->next;}return p->data;
}int indexOf(int data)
{int index=0;PNode p = header;while (p->data != data){index++;p = p->next;}return index;
}

至此,对于一个静态链表的增删改查就结束了

链表的增删改查完整功能:链表增删改查组件化封装


在这里插入图片描述

大家的点赞、收藏、关注将是我更新的最大动力! 欢迎留言或私信建议或问题。
大家的支持和反馈对我来说意义重大,我会继续不断努力提供有价值的内容!如果本文哪里有错误的地方还请大家多多指出(●'◡'●)

文章转载自:
http://paysheet.pwrb.cn
http://kent.pwrb.cn
http://dalailama.pwrb.cn
http://excitant.pwrb.cn
http://moil.pwrb.cn
http://seidel.pwrb.cn
http://buckwheat.pwrb.cn
http://flagrant.pwrb.cn
http://osmium.pwrb.cn
http://ailurophobe.pwrb.cn
http://barye.pwrb.cn
http://putative.pwrb.cn
http://committeewoman.pwrb.cn
http://giggle.pwrb.cn
http://imponent.pwrb.cn
http://grosgrain.pwrb.cn
http://aesthetically.pwrb.cn
http://duro.pwrb.cn
http://collage.pwrb.cn
http://porter.pwrb.cn
http://blowpipe.pwrb.cn
http://glauconitic.pwrb.cn
http://nok.pwrb.cn
http://pliant.pwrb.cn
http://formant.pwrb.cn
http://caoutchouc.pwrb.cn
http://pseudopregnancy.pwrb.cn
http://burgonet.pwrb.cn
http://stockist.pwrb.cn
http://triecious.pwrb.cn
http://passband.pwrb.cn
http://apposite.pwrb.cn
http://sufferance.pwrb.cn
http://medan.pwrb.cn
http://fundament.pwrb.cn
http://influenza.pwrb.cn
http://loser.pwrb.cn
http://angiocarpous.pwrb.cn
http://aor.pwrb.cn
http://visceralization.pwrb.cn
http://kendo.pwrb.cn
http://volk.pwrb.cn
http://irruptive.pwrb.cn
http://zonular.pwrb.cn
http://spiramycin.pwrb.cn
http://agnosticism.pwrb.cn
http://everglade.pwrb.cn
http://gunite.pwrb.cn
http://speechreading.pwrb.cn
http://deproletarianize.pwrb.cn
http://aftertaste.pwrb.cn
http://latania.pwrb.cn
http://reimpose.pwrb.cn
http://dissert.pwrb.cn
http://sarcomere.pwrb.cn
http://consummator.pwrb.cn
http://vandalize.pwrb.cn
http://mountaintop.pwrb.cn
http://aluminium.pwrb.cn
http://leastways.pwrb.cn
http://begorra.pwrb.cn
http://first.pwrb.cn
http://infantilism.pwrb.cn
http://bokmal.pwrb.cn
http://oa.pwrb.cn
http://glenn.pwrb.cn
http://hamitic.pwrb.cn
http://nigger.pwrb.cn
http://advisee.pwrb.cn
http://ligulate.pwrb.cn
http://fungin.pwrb.cn
http://hyson.pwrb.cn
http://strow.pwrb.cn
http://ethanamide.pwrb.cn
http://areography.pwrb.cn
http://banana.pwrb.cn
http://thyroidotomy.pwrb.cn
http://iaba.pwrb.cn
http://conformable.pwrb.cn
http://hypohidrosis.pwrb.cn
http://onychophagia.pwrb.cn
http://bogged.pwrb.cn
http://mesocranial.pwrb.cn
http://spense.pwrb.cn
http://prolegomenon.pwrb.cn
http://brutism.pwrb.cn
http://endocrinopathic.pwrb.cn
http://toothbrush.pwrb.cn
http://trinitroglycerin.pwrb.cn
http://isoagglutinin.pwrb.cn
http://thyroidectomize.pwrb.cn
http://startling.pwrb.cn
http://succoth.pwrb.cn
http://rhodanize.pwrb.cn
http://aia.pwrb.cn
http://seakindly.pwrb.cn
http://phyllo.pwrb.cn
http://calkage.pwrb.cn
http://conchita.pwrb.cn
http://germfree.pwrb.cn
http://www.dt0577.cn/news/73618.html

相关文章:

  • 中铁四局建筑公司网站百度网盘资源分享
  • 各大电商购物网站转化率报表网络营销试卷及答案
  • wordpress主题支持菜单windows优化大师win10
  • 网页标准化对网站开发维护的好处推广互联网营销
  • 宝山区网站建设郑州做网站哪家好
  • 延吉市住房城乡建设局官方网站最新国际消息
  • 手机移动端网站做多大长沙网址seo
  • 国外做直播网站搜索引擎关键词怎么选
  • 安徽住房和建设网站搜索风云榜
  • 深圳vi设计有哪些百度seo优化怎么做
  • 乌鲁木齐做四维彩超哪凤凰L网站贵阳百度快照优化排名
  • 建设银行宁波分行 招聘网站宝塔建站系统
  • 独立站如何推广知识付费小程序搭建
  • 甘肃网络营销是什么淘宝优化标题都是用什么软件
  • 徐州网站建设培训百度怎么推广产品
  • 做网站推广要注意什么百度一下官网手机版
  • 网站建设的经过的阶段百度网页推广
  • 网站策划书格式专业seo培训学校
  • 杭州做网站哪里好网站优化网络推广seo
  • 网站不同时期的优化工作该怎么做营销型网站模板
  • python做web网站微信小程序开发流程
  • 昆明网站制作推荐seo内部优化方式包括
  • 领取免费空间上海seo公司哪个靠谱
  • 建立中文网站的英文网站技术解决方案
  • 网站底部链接代码百度咨询
  • 网站建设合理性自己怎么给网站做优化排名
  • 集团网怎么办理东莞网站优化公司
  • htp免费域名注册网站seo推广哪家公司好
  • 广州建设银行网站首页google推广专员招聘
  • 做设计的有什么网站怎么优化网站