- 博客(4)
- 收藏
- 关注
原创 链表之三种删除
链表–删除 :首先要清楚把一个节点删除,要考虑删除节点的上一个节点next指针,不能删除空的东西 #include<stdio.h> #include<stdlib.h> struct Node { int data; struct Node* next; }; //创建表头 struct Node* createHead() { struct Node* headNode = (struct Node*)malloc(sizeof(struct Node)); if (h
2021-03-07 10:05:07
1030
原创 链表之指定位置插入
指定位置插入: 做这种查找类的插入,先不要着急创建节点,要考虑没找到的情况,没找到就不需要创建节点 #include<stdio.h> struct Node { int data; struct Node* next; } //创建头节点 struct Node* createHead() { struct Node* headNode=(struct Node*)malloc(sizeof(struct Node)); if(headNode==NULL) { return 0
2021-03-05 22:16:40
1656
1
原创 链表之尾插法
有头链表之尾插法: 首先要了解尾插的概念:什么是尾插? 当next指针是空的时候就是链表尾部 #include<stdio.h> #include<stdlib.h> //创建数据 struct Node { int data; struct Node* next; } //创建头节点 struct Node* createHead() { struct Node* headNode=(struct Node*)malloc(sizeof(struct Node)); if
2021-03-05 20:44:10
1266
原创 链表上手代码---表头插入
链表上手代码—表头插入 #include<stdio.h> struct Node //创建链表 { int data; struct Node* next; } ///1.创建表头 struct Node* createHead() { //动态内存申请 struct Node* headNode=(struct Node*)malloc(sizeof(struct Node)); //给变量里的数据初始化 headNode->next=NULL; return head
2021-03-02 22:38:49
750
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人