1.思维导图
2. 顺序表去重
/*----------顺序表的去重------------*/
void distinct_seq_list(seq_p L)
{
if(L==NULL)
{
printf("参数为空,请检查\n");
return;
}
if(empty_seq_list(L))
{
printf("顺序表已空,无法去重\n");
return;
}
int i,j,k;
for(i=0;i<L->len-1;i++)
{
for(j=i+1;j<L->len;j++)
{
if(L->arr[i]==L->arr[j])
{
for(k=j;k<L->len;k++)
{
L->arr[k]=L->arr[k+1];
}
L->len--;
}
}
}
}
3.链表的创建
node_p create_link_list(void)
{
node_p Head_node=(node_p)malloc(sizeof(node));
if(Head_node==NULL)
{
printf("空间申请失败\n");
return NULL;
}
Head_node->len=0;
Head_node->next=NULL;
return Head_node;
}
4.结点的创建
node_p create_link_node(datatype date)
{
node_p New_node=(node_p)malloc(sizeof(node));
if(New_node==NULL)
{
printf("空间申请失败\n");
return NULL;
}
New_node->date=date;
New_node->next=NULL;
return New_node;
}
5.单链表的头插
void insert_head_link_list(node_p Head_node,node_p New_node,datatype newdate)
{
if(Head_node==NULL||New_node==NULL)
{
printf("参数为空,请检查\n");
return;
}
New_node->next=Head_node->next;
Head_node->next=New_node;
New_node->date=newdate;
Head_node->len++;
}