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

网页编辑超级工具箱seo哪里有培训

网页编辑超级工具箱,seo哪里有培训,手机版网站制作模板,优化网站流量1.单链表 线性表:1.有限的序列 2.序列中的每一个元素都有唯一的前驱和后继,除了开头和结尾的两个节点。 顺序表:分配一块连续的内存去存放这些元素,eg、数组 链表:内存是不连续的,元素会各自被分配一块内…

1.单链表
线性表:1.有限的序列 2.序列中的每一个元素都有唯一的前驱和后继,除了开头和结尾的两个节点。

顺序表:分配一块连续的内存去存放这些元素,eg、数组

链表:内存是不连续的,元素会各自被分配一块内存,内存和内存之间用指针进行相连。

顺序表和链表的区别是内存的连续与否

 data域 | next指针域 ——> data域 | next指针域 ——> data域 | next指针域 ——> NULL

单链表的操作:
1.增加 :1>头插法 2>尾插法
1>插入——> data域 | next指针域 ——> data域 | next指针域 ——> data域 | next指针域 ——> NULL
2>data域 | next指针域 ——> data域 | next指针域 ——> data域 | next指针域 ——> 插入——>NULL
2.删除:用前一个节点的指针直接指向对应节点的后一个节点的前驱,只操作一个指针。
为了使操作方便,在操作中添加一个头节点。头节点并不实际存储,只保存链表中的元素个数。
代码实现:

定义一个链表(结构体):

typedef struct Node {//定义一个结构体链表int data;//data域struct Node* next;//next指针
}Node;

初始化一个链表:

Node* initList() {//初始化一个链表Node* list = (Node*)malloc(sizeof(Node));//给新节点开辟空间list->data = 0;//data域list->next = NULL;//next指针return list;
}

头插法:

void headInsert(Node* list,int data){//头插法 list是头节点 data域Node* node = (Node*)malloc(sizeof(Node));//开辟空间,定义一个新节点node->data = data;//新节点的data域node->next = list->next;//新节点的next指针等于原先链表的头指针的nextlist->next = node;//原先头节点next指向新插入的头节点list->data++;//代表当前链表之中插入元素
}

尾插法:

void tailInsert(Node* list, int data){//尾插法Node* head = list;//头指针为定义的list头节点Node* node = (Node*)malloc(sizeof(Node));//定义新节点,开辟空间node->data = data;//新节点的data域等于原先链表头节点的data域 node->next = NULL;//尾插的新节点next为空list = list->next;//原先头节点往后延续while (list->next) {//判断是否到了最后list = list->next;}list->next = node;//先将头节点指针指向最后 头节点的下一个等于新插入的node节点head->data++;
}

删除:

void Delete(Node* list, int data){//删除Node* head = list;Node* pre = list;Node* current = list->next;list = list->next;while (current)//循环遍历到最后{if (current->data == data)//判断与删除元素是否相等{pre->next = current->next;free(current);//删除结点break;//找到则跳出循环}pre = current;//向下遍历current = current->next;}list->data--;
}

遍历操作:

void printList(Node* list) {//遍历操作list = list->next;//向后遍历while (list)//判空循环{printf("%d ", list->data);list = list->next;}printf("\n");
}

main函数:

int main()
{Node* list = initList();headInsert(list, 1);headInsert(list, 2);headInsert(list, 3);headInsert(list, 4);headInsert(list, 5);tailInsert(list, 6);tailInsert(list, 7);tailInsert(list, 8);tailInsert(list, 9);tailInsert(list, 10);printList(list);Delete(list, 5);printList(list);Delete(list, 10);printList(list);Delete(list, 6);printList(list);return 0;
}

整体函数:

typedef struct Node {//定义一个结构体int data;struct Node* next;
}Node;Node* initList() {//初始化一个链表Node* list = (Node*)malloc(sizeof(Node));list->data = 0;list->next = NULL;return list;
}void headInsert(Node* list,int data){//头插法Node* node = (Node*)malloc(sizeof(Node));node->data = data;node->next = list->next;list->next = node;list->data++;//代表当前链表之中插入元素
}void tailInsert(Node* list, int data){//尾插法Node* head = list;Node* node = (Node*)malloc(sizeof(Node));node->data = data;node->next = NULL;list = list->next;while (list->next) {list = list->next;}list->next = node;head->data++;
}void Delete(Node* list, int data){//删除Node* head = list;Node* pre = list;Node* current = list->next;list = list->next;while (current){if (current->data == data){pre->next = current->next;free(current);break;}pre = current;current = current->next;}list->data--;
}void printList(Node* list) {//遍历操作list = list->next;while (list){printf("%d ", list->data);list = list->next;}printf("\n");
}int main()
{Node* list = initList();headInsert(list, 1);headInsert(list, 2);headInsert(list, 3);headInsert(list, 4);headInsert(list, 5);tailInsert(list, 6);tailInsert(list, 7);tailInsert(list, 8);tailInsert(list, 9);tailInsert(list, 10);printList(list);Delete(list, 5);printList(list);Delete(list, 10);printList(list);Delete(list, 6);printList(list);return 0;
}

运行结果:

http://www.mmbaike.com/news/87729.html

相关文章:

  • 顶尖的设计网站百度快速收录软件
  • 英语网站建设网站seo视频教程
  • wordpress速度优化存百度seo排名规则
  • 慈溪seo排名广州seo实战培训
  • 专门做招商的网站是什么网址查询工具
  • 自己做的网站怎么加搜索功能企业培训考试平台官网
  • 网站公司靠什么赚钱淘宝指数官网
  • 网站制作公司咨询网站制作公司厦门百度关键词优化
  • 个人网站建设教学视频泉州百度网站推广
  • 这样做网站推广seo学徒招聘
  • 工 投标做哪个网站好百度指数分析数据
  • 做dw网站图片怎么下载地址软文推广网站
  • 网络营销就是seo麒麟seo
  • 建设银行鞍山网站seo外链优化
  • 做外贸网站价格手机助手
  • 青岛做教育的网站百度网页版链接地址
  • 网站制作一条龙网络seo软件
  • wordpress改为中文如何刷seo关键词排名
  • 专业展示设计网站seo站长论坛
  • 余姚网站建设在哪里刚刚发生了一件大事
  • 诸城网站开发关键词查找
  • 网站首页有被收录就是最近没有被抓取是怎么回事爱链网中可以进行链接买卖
  • 一个完美的网站怎么做“跨年”等关键词搜索达年内峰值
  • 有了实名制域名怎么做网站今天全国31个省疫情最新消息
  • 北仑网站建设seo查询seo
  • 制作网站客服系统搜索引擎营销优化策略有哪些
  • 没有网站怎么做cps优化方案怎么写
  • 平板怎么做网页seo 公司
  • 深圳网站建设 site网站推广公司大家好
  • 网站客服系统代码外贸网站建设推广公司