已给单链表的头指针为h,每个节点的数据域data为整型,指针域为next,设计一个算法inserta(H,d),实现若d已在链表中,则输出‘已存在’,然后返回,否则将d插入到链表的最后
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
typedef struct Node //创建链表
{
int data;
struct Node *next;
}List;
void InputList(List *); //初始化函数声明
int Inserta(List *,int); //查找或添加声明
main()
{
int d;
List *h
原创
2021-11-16 16:01:35 ·
1390 阅读 ·
0 评论