文章

37

粉丝

67

获赞

3

访问

9.2k

头像
链表合并 题解:简单
P1025 贵州大学2019机试
发布于2024年3月5日 21:08
阅读数 238


#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
struct node {
    int data;
    struct node * next;
};

struct node* create(int nums[],int n) {
    struct node *head=NULL,*q;
    for (int i = 0; i <n; i++) {
        struct node *p = (struct node*)malloc(sizeof(struct node));
        p->data = nums[i];
        if (head == NULL) {
            head = p;
            p->next = NULL;
        }
        else {
            q = head;
            //尾插法
            while (q->next != NULL...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发