文章

11

粉丝

407

获赞

1

访问

111.7k

头像
单链表排序
备考心情
发布于2020年4月24日 11:39
阅读数 10.3k

单链表pai

#include
using namespace std;
struct node{
    int data;
    struct node *next;
};

struct node* create(int a[]){
    struct node *p,*L,*head,*pre;
    int i;
    head=(struct node*)malloc(sizeof(node));//动态分配空间 
    head->next=NULL;
    L=head;
    for(i=0;i<5;i++){//分配的值 
        p=(struct node*)malloc(sizeof(node));
        p->data=a[i];
        p->next=L->next;
        L->next=p;
    }
    return head;
}

void sort(struct node* L){
    struct node *pre,*p,*r;
    p=L->next;
    r=p->next;
    p->next=NULL;
    p=r;
    while(p){
    &nb...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发