单链表建立
来源:互联网 发布:sql注入式攻击 编辑:程序博客网 时间:2024/05/22 12:34
struct node{int data;node* next;};node* head;//尾插法建立:void creat(){ head=NULL; node* r=NULL; int x; for(int i=0;i<len;i++) { cin>>x; node* p=new node; p->data=x; if(head==NULL) { head=p; } else { r->next=p; } r=p; } r->next=NULL; node* newhead=new node; newhead->next=head; head=newhead;}//或者(尾插法建立2)node* creat(){ head=new node; head->next=NULL; node* r=head; node*p; int x; for( int i=0;i<len;i++) { cin>>x; p=new node; p->data=x; p->next=r->next; r->next=p; r=p; } r->next=NULL; return head;}//头插法建立:void creat(){ head=new node; head->next=NULL; node* p=NULL; int x; for(int i=0;i<len;i++){ p=new node;cin>>x; p->data=x; p->next=head->next; head->next=p; } }
阅读全文
0 0
- 建立单链表
- 建立单链表
- 建立单链表
- 单链表建立
- 单链表建立
- 单链表的建立
- 单链表的建立
- 单链表的建立
- 单链表的建立
- 循环单链表的建立
- 尾插法建立单链表 c
- 头插法建立单链表 c
- 单链表的建立程序
- 单链表的建立
- 单链表的建立
- 建立排序的单链表
- 单链表的建立
- 单链表建立和逆序
- 从零开始搭建ELK+GPE监控预警系统
- transformClassesWithJarMergingForRelease解决办法 解决版本冲突 解决jar包冲突
- 迷宫求解问题
- H5部署上线测试完成有点小小的成就感
- 基于R-CNN的物体检测
- 单链表建立
- stm32 memcpy 错位问题
- Fragment写主页
- Linux标准目录结构
- Uncaught TypeError: s.elem.on is not a function
- Angular4的表单
- 网页调用本地windows应用例子
- Mysql视图相关操作
- bootstrap-validator使用笔记