8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 60fa8bf + 01a56f6 commit 26d1859Copy full SHA for 26d1859
C++/chapSorting.tex
@@ -62,14 +62,14 @@ \subsubsection{代码}
62
ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) {
63
if (l1 == nullptr) return l2;
64
if (l2 == nullptr) return l1;
65
- ListNode h(-1);
66
- ListNode *p = &h;
+ ListNode dummy(-1);
+ ListNode *p = &dummy;
67
for (; l1 != nullptr && l2 != nullptr; p = p->next) {
68
if (l1->val > l2->val) { p->next = l2; l2 = l2->next; }
69
else { p->next = l1; l1 = l1->next; }
70
}
71
p->next = l1 != nullptr ? l1 : l2;
72
- return h.next;
+ return dummy.next;
73
74
};
75
\end{Code}
0 commit comments