摘要: /*求表长*/ #include<stdio.h> #include<stdlib.h> //链表中节点的结构 typedef struct Link { int data; struct Link* next; }link; //链表初始化 link* initLink(link* phead) 阅读全文
posted @ 2020-03-10 23:53 shanlu 阅读(419) 评论(0) 推荐(0) 编辑
摘要: 1,首先将链表初始值改为用户的输入 2,根据用户的输入,打印出初始化后的链表 3,用户继续输入希望寻找的值 4,根据这个值在链表中寻找数据域是这个值的结点,并计数,最后返回满足条件的结点个数 1 /*返回特定数据域值的结点个数*/ 2 3 #include<stdio.h> 4 #include<s 阅读全文
posted @ 2020-03-10 23:48 shanlu 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 根据用户输入的号码,找到这个号码对应的值 1 /*按号定位*/ 2 3 #include<stdio.h> 4 #include<stdlib.h> 5 6 //链表中节点的结构 7 typedef struct Link { 8 int data; 9 struct Link* next; 10 阅读全文
posted @ 2020-03-10 23:30 shanlu 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 根据用户输入的元素,查找这个元素在链表中是第几个 1 /*按值定位*/ 2 3 #include<stdio.h> 4 #include<stdlib.h> 5 6 //链表中节点的结构 7 typedef struct Link { 8 int data; 9 struct Link* next; 阅读全文
posted @ 2020-03-10 22:53 shanlu 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 1,创建尾指针的方式,让尾指针不断往前移动 1 /*头插入创建单链表*/ 2 3 #include<stdio.h> 4 #include<stdlib.h> 5 6 typedef struct Link { 7 int data; 8 struct Link* next; 9 }link; 10 阅读全文
posted @ 2020-03-10 22:19 shanlu 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 1,使用头指针的方式,不创建头结点 1 /*尾插入实现方法2*/ 2 #include<stdio.h> 3 #include<stdlib.h> 4 5 //链表中节点的结构 6 typedef struct Link { 7 int data; 8 struct Link* next; 9 }l 阅读全文
posted @ 2020-03-10 18:26 shanlu 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 1,创建单链表,用尾插入法给单链表赋初始值,并打印出链表的全部数据 1 /*尾插入法 2 创建单链表 3 */ 4 5 6 #include<stdio.h> 7 #include<stdlib.h> 8 9 //链表内存结构 10 typedef struct LinkList { 11 int 阅读全文
posted @ 2020-03-10 15:04 shanlu 阅读(552) 评论(0) 推荐(0) 编辑