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

工邦邦官网深圳关键词推广整站优化

工邦邦官网,深圳关键词推广整站优化,个人网站可以做商城吗,常州规划网站2.单循环链表 data|next——>data|next——>data|next——>头节点 1.初始化链表 2.增加节点(头插法、尾插法) 3.删除节点 4.遍历链表 定义一个结构体,存放data域和指针域: typedef struct Node {//定义一个结构体&…

2.单循环链表
data|next——>data|next——>data|next——>头节点
1.初始化链表
2.增加节点(头插法、尾插法)
3.删除节点
4.遍历链表

定义一个结构体,存放data域和指针域:

typedef struct Node {//定义一个结构体,存放data域和指针域int data;//数据域类型struct Node* next;
}Node;

初始化链表:

Node* initList() {//初始化链表Node* L = (Node*)malloc(sizeof(Node));L->data = 0;L->next = L;return L;
}

头插法:

void headInsert(Node* L, int data) {//头插法Node* node = (Node*)malloc(sizeof(Node));node->data = data;node->next = L->next;L->next = node;
}

尾插法 :

void tailInsert(Node* L, int data) {//尾插法Node* n = L;Node* node = (Node*)malloc(sizeof(Node));node->data = data;while (n->next != L) {n = n->next;}node->next = L;n->next = node;
}

删除:

int Delete(Node* L, int data)//删除
{Node* preNode = L;Node* node = L->next;while (node != L){if (node->data == data) {//deletepreNode->next = node->next;free(node);return true;}preNode = node;node = node->next;}return false;
}

遍历链表:

void printList(Node* L) {//遍历链表Node* node = L->next;while (node != L) {printf("%d->", node->data);node = node->next;}printf("NULL\n");
}

main函数:

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

单循环链表函数

typedef struct Node {//定义一个结构体,存放data域和指针域int data;//数据域类型struct Node* next;
}Node;Node* initList() {//初始化链表Node* L = (Node*)malloc(sizeof(Node));L->data = 0;L->next = L;return L;
}void headInsert(Node* L, int data) {//头插法Node* node = (Node*)malloc(sizeof(Node));node->data = data;node->next = L->next;L->next = node;
}void tailInsert(Node* L, int data) {//尾插法Node* n = L;Node* node = (Node*)malloc(sizeof(Node));node->data = data;while (n->next != L) {n = n->next;}node->next = L;n->next = node;
}int Delete(Node* L, int data)//删除
{Node* preNode = L;Node* node = L->next;while (node != L){if (node->data == data) {//deletepreNode->next = node->next;free(node);return true;}preNode = node;node = node->next;}return false;
}void printList(Node* L) {//遍历链表Node* node = L->next;while (node != L) {printf("%d->", node->data);node = node->next;}printf("NULL\n");
}int main()
{Node* L = initList();headInsert(L, 1);headInsert(L, 2);headInsert(L, 3);headInsert(L, 4);headInsert(L, 5);tailInsert(L, 6);tailInsert(L, 7);tailInsert(L, 8);tailInsert(L, 9);tailInsert(L, 10);printList(L);Delete(L, 4);Delete(L, 5);printList(L);return 0;
}

http://www.shuangfujiaoyu.com/news/61731.html

相关文章:

  • 建立av网站推广公司是做什么的
  • 做优惠券的网站搭建今天
  • wordpress数据库分离seo搜索引擎优化业务
  • 织梦做商城网站广州seo网站推广优化
  • 哈尔滨网站开发建设公司广州疫情升级
  • 网站设计开发收费标准地方网站建设
  • 南宁党员两学一做网站软文广告案例分析
  • 网站上的视频直播是怎么做的呢乔拓云网站建设
  • 哪些网站可做矿机期货品牌网站建设制作
  • 中卫网站制作公司网站如何宣传推广
  • 登封 网站建设html网页设计模板
  • 招聘网站开发成本网站建设外包
  • icp备案系统网站宣传广告
  • 网站本地建设如何创建一个app
  • wordpress主题 外贸网站站长素材官网
  • 做网站需要学啥兰州seo技术优化排名公司
  • 新疆网站建设公司初学者做电商怎么入手
  • 新闻网站开发的意义百度空间登录入口
  • 莘县做网站深圳网络提速优化服务包
  • 电子工程王牌专业郴州seo
  • 淘宝优惠的网站怎么做百度网盘人工客服电话多少
  • 无锡网站备案排名优化公司哪家好
  • 网站建设目标是seo自动优化软件
  • 怎么自己做歌曲网站百度极速版下载安装最新版
  • 滨州做网站建设的公司免费观看行情软件网站下载
  • 网站开发 顺德建站系统哪个好
  • mac无法更新wordpressseo排名赚挂机
  • 药品在哪些网站做推广免费下载百度
  • 不锈钢公司网站源码 网站建设 产品3级分类asp源码爱站工具
  • 网站设置快捷方式网站推广关键词工具