- 博客(29)
- 收藏
- 关注
原创 单链表的应用
一、单链表的逆置可以把逆置的过程看成是重新逆序建链表的过程。逆置带头结点的单链表的函数如下:void reserve (struct node * head){ struct node *p, *q; p = head->next; head->next = NULL; q = p->next; while (p!=NULL) { p->next = head->next; head
2022-04-11 20:10:10
1388
原创 单链表的建立
一、顺序建立链表(尾插法)1、首先建立一个只需头结点的空链表,此时头指针、尾指针均指向头结点 head=(struct node*)malloc(sizeof(struct node)); head->next=NULL;2、在头结点后插入第一个节点p=(struct node*)malloc(sizeof(struct node));scanf("%d",&p->data);p->next=NULL;tail=head;tail->next..
2022-04-11 17:24:04
15680
5
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人