包括定义的链表,插入数据,及输出打印
#include <iostream>
#include <vector>
#include <numeric>
#include<algorithm>
using namespace std;
struct Node {
int x;
Node* next;
Node(int x1, Node* next1) {
x = x1;
next = next1;
}
};
//--两个有序链表合并-假设排列方式为从小到大--
Node* sortHead(Node* head1, Node* head2) {
if (head1 == NULL) return head2;
if (head2 == NULL) return head1;
Node* returnHead = head1->x < head2->x