Skip to content

Commit

Permalink
Merge pull request soulmachine#11 from advancedxy/master
Browse files Browse the repository at this point in the history
change variable name h to dummy to follow name convention
  • Loading branch information
soulmachine committed Jan 7, 2014
2 parents c4f6258 + c6a7e96 commit 01a56f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions C++/chapSorting.tex
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ \subsubsection{代码}
ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) {
if (l1 == nullptr) return l2;
if (l2 == nullptr) return l1;
ListNode h(-1);
ListNode *p = &h;
ListNode dummy(-1);
ListNode *p = &dummy;
for (; l1 != nullptr && l2 != nullptr; p = p->next) {
if (l1->val > l2->val) { p->next = l2; l2 = l2->next; }
else { p->next = l1; l1 = l1->next; }
}
p->next = l1 != nullptr ? l1 : l2;
return h.next;
return dummy.next;
}
};
\end{Code}
Expand Down

0 comments on commit 01a56f6

Please sign in to comment.