We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents c4f6258 + c6a7e96 commit 01a56f6Copy full SHA for 01a56f6
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