2116数据结构实验之链表一:顺序建立链表
来源:互联网 发布:php超时时间设置 编辑:程序博客网 时间:2024/04/25 10:28
2116数据结构实验之链表一:顺序建立链表
#include<iostream>#include<malloc.h>using namespace std;struct node{ int data; struct node *next;};struct node *creat(int n){ struct node *head,*tail,*p; int i; head=(struct node *)malloc(sizeof(struct node)); head->next=NULL; tail=head; for(i=1;i<=n;i++) { p=(struct node *)malloc(sizeof (struct node )); cin>>p->data; p->next=NULL; tail->next=p; tail= p; }//顺逆序的根本区别 return head;};void display(struct node *head){ struct node *q; q=head->next; while(q!=NULL) { cout << q->data; if(q->next!=NULL) cout<< " "; q=q->next; } cout<<endl;}int main(){ int n,h; struct node *head; cin >>n; head=creat(n); display(head); return 0;}
0 0
- SDUTOJ 2116 数据结构实验之链表一:顺序建立链表
- 【2116】数据结构实验之链表一:顺序建立链表
- SDUTOJ 2116 数据结构实验之链表一:顺序建立链表
- SDUT 2116 数据结构实验之链表一:顺序建立链表
- SDUT 2116----数据结构实验之链表一:顺序建立链表
- 【2116】数据结构实验之链表一:顺序建立链表
- 2116数据结构实验之链表一:顺序建立链表
- 2116数据结构实验之链表一:顺序建立链表
- SDUT 2116数据结构实验之链表一:顺序建立链表
- 2116 数据结构实验之链表一:顺序建立链表
- SDUT 2116-数据结构实验之链表一:顺序建立链表
- 数据结构实验之链表一:顺序建立链表
- 数据结构实验之链表一:顺序建立链表
- 数据结构实验之链表一:顺序建立链表
- 数据结构实验之链表一:顺序建立链表
- 数据结构实验之链表一:顺序建立链表
- 数据结构实验之链表一:顺序建立链表
- 数据结构实验之链表一:顺序建立链表
- 深度优先搜索 + 奇偶剪枝【HDU 1010】
- 9月份英语总结
- Httpclient4.5.2 POST Json 数据到另外一个网站, 解析
- k-d tree算法的研究
- 导航栏控制器push页面时候会卡一下?
- 2116数据结构实验之链表一:顺序建立链表
- android Context 理解
- 深度理解javascript(5):instanceof
- Radar Installation
- 图论总结(一)
- 深度学习(5) Normal Equations 的由来
- ECLIPSE中设置.CLASS文件的输出路径及“JAVA BUILD PATH”的设置
- Xcode7 真机调试出现错误:The executable was signed with invalid entitlements.(The entitlements specified in y
- herbinate的配置