#include <iostream> using namespace std; //别问我为什么要写链表的冒泡排序. struct Node { int data; Node *next; Node(int d = int()) :data(d), next(NULL){} }; class List { public: List(int a[], int n) { first = NULL; for (int i = 0; i < n; i++) { if (first == NUL…
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 分析:思路比较简单,遍历两个有序链表,每次指向最小值. code如下: /** * Definition for singly-linked list. * struct ListNode { * int val;…