数据结构 单链表基本操作代码.docx
《数据结构 单链表基本操作代码.docx》由会员分享,可在线阅读,更多相关《数据结构 单链表基本操作代码.docx(2页珍藏版)》请在三一办公上搜索。
1、数据结构 单链表基本操作代码实验一 单链表 #include stdio.h #include stdlib.h typedef int ElemType; typedef struct LNode ElemType data; struct LNode *next; LNode,*LinkList; void creatLNode(LinkList &head) int i,n; LNode *p; head=(LNode*)malloc(sizeof(LNode); head-next=NULL; printf(请输入链表的元素个数:); scanf(%d,&n); for(i=n;i0;
2、i-) p=(LNode*)malloc(sizeof(LNode); printf(第%d个元素:,i); scanf(%d,&p-data); p-next=head-next; head-next=p; void InsertLNode(LinkList &L) LNode *p=L; int i,j=0,e; printf(请输入你要插入的位置:); scanf(%d,&i); printf(请输入你要插入的元素:); scanf(%d,&e); while (p-next&jnext; +j; LNode *s; s=(LNode*)malloc(sizeof(LNode); s-d
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数据结构 单链表基本操作代码 单链表 基本 操作 代码
链接地址:https://www.31ppt.com/p-3560067.html