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

北京 手机网站建设wordpress发表文章

北京 手机网站建设,wordpress发表文章,wordpress试玩app,wordpress 网页图标1.单链表 线性表#xff1a;1.有限的序列 2.序列中的每一个元素都有唯一的前驱和后继#xff0c;除了开头和结尾的两个节点。 顺序表#xff1a;分配一块连续的内存去存放这些元素#xff0c;eg、数组 链表#xff1a;内存是不连续的#xff0c;元素会各自被分配一块内…1.单链表 线性表1.有限的序列 2.序列中的每一个元素都有唯一的前驱和后继除了开头和结尾的两个节点。 顺序表分配一块连续的内存去存放这些元素eg、数组 链表内存是不连续的元素会各自被分配一块内存内存和内存之间用指针进行相连。 顺序表和链表的区别是内存的连续与否 data域 | next指针域 —— data域 | next指针域 —— data域 | next指针域 —— NULL 单链表的操作 1.增加 1头插法 2尾插法 1插入—— data域 | next指针域 —— data域 | next指针域 —— data域 | next指针域 —— NULL 2data域 | next指针域 —— data域 | next指针域 —— data域 | next指针域 —— 插入——NULL 2.删除用前一个节点的指针直接指向对应节点的后一个节点的前驱只操作一个指针。 为了使操作方便在操作中添加一个头节点。头节点并不实际存储只保存链表中的元素个数。 代码实现 定义一个结构体 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); } 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.zqtcl.cn/news/413472/

相关文章:

  • 重庆seo网站推广工具济南网页设计师招聘信息
  • 甘肃永靖建设住建局网站深圳网络广告推广公司
  • 台州企业网站搭建电话厦门学网站建设
  • 做易经网站做网站布为网
  • 高端定制开发网站可以做网站的网络
  • 局政务网站建设管理工作总结wordpress ks主题
  • 网站集约化建设的意义网页制作成app
  • 建设银行大厂支行网站专业的营销型网站建设公司
  • 询盘网站苏州建设银行招聘网站
  • 制作网站图片手机网站跳转
  • 装修公司营销网站模板东莞家居网站建设
  • 网站模板建站教程视频德州极速网站建设百家号
  • 专做蔬菜水果的网站自学it从哪里学起
  • 邵阳红网站搭建平台聚合力
  • 滁州网站建设信息推荐软件开发技术方案模板
  • 商务网站建设有哪几个步骤拼多多网页qq登录
  • 厦门商城网站开发宜昌小程序开发公司
  • 东莞沙田网站建设榆林网站建设价格
  • 无锡网站制作建设wordpress写文章模板
  • 企业网站销售提升学历要多少钱
  • 打开建设银行官方网站首页wordpress 站库分离
  • 电子商务网站建设的试卷设计之家app
  • 抚养网站建设黔东南小程序开发公司
  • 网站建设相关行业有哪些wordpress 内容管理系统
  • 网站 备案地温州网站优化排名推广
  • 做网站的工作量国内 wordpress
  • 定制网站开发是什么大业推广网站
  • 网站建设每年需要交多少钱天津制作网站公司
  • 网站平台都有哪些wordpress 主题制作 视频
  • 中山网站建设方案家具网站开发目的