线性链表C
来源:互联网 发布:有道翻译无网络连接 编辑:程序博客网 时间:2024/05/22 05:20
#include<stdio.h>#include<malloc.h>#define NULL 0typedef int ElemType;typedef struct node{ElemType data;node *next;}*Node;void Creat_list(Node &head)//头插法插入新节点{int x;head->next=NULL;Node p=new node;printf("请输入数据,以0结束\n");scanf("%d",&x);while(x){Node u=new node;u->data=x;u->next=head->next;head->next=u;scanf("%d",&x);}}void Display_list(Node head){Node p=new node;p=head->next;printf("现在的LIST为:\n");while(p){printf("%d\n",p->data);p=p->next;}}void Insert_list(Node &head,ElemType x,int n){Node p=new node;p=head->next;int i=1;for(i=1;i<=n;i++)p=p->next;Node u=new node;u->data=x;u->next=p->next;p->next=u;}void Delete_list(Node &head,int n){ Node p=new node; Node u=new node;p=head->next;int i=1;for(i=1;i<=n;i++)p=p->next;u=p->next;p->next=u->next;}void main(){printf("本程序是用头插法插入节点,因此反序乃正常现象\n");node head;Node p=new node;Creat_list(p);Display_list(p);Insert_list(p,677,2);Display_list(p);Delete_list(p,2);Display_list(p);}
0 0
- 线性链表C
- c 线性链表程序
- 线性链表(C语言实现)
- C语言实现线性顺序链表
- 线性链表的c语言实现
- 线性表(C++)
- 数据结构-线性表 (C++)
- Objective-C 线性表
- 数据结构线性表c
- 线性顺序表C
- 线性表--单链表(C++)
- C - 数据结构 - 线性表
- C线性表
- 线性表 C
- 线性表(C++)
- 线性表(C++)
- C构造线性表
- C语言-线性表
- ios 判断网络是否可用
- 黑马程序员-管道流-RandomAccessFile-DateInputStream-ByteArrayOutputStream-转换流-InputStreamReader
- 客户端与服务器端的区别
- 黑马程序员---java基础----数组
- LeetCode--Valid Parentheses
- 线性链表C
- call 电话
- G - 好老师
- 将Axis2整合到Javaweb中发布Webservice
- jQuery form插件的使用
- 在OpenGL中怎样安装glut库
- OpenStack 最小化安装配置(七):Nova服务配置
- 浅谈C++多态性
- 求从n个数组任意选取一个元素的所有组合