Skip to content

Commit

Permalink
change variable name h to dummy to follow name convention
Browse files Browse the repository at this point in the history
  • Loading branch information
advancedxy committed Jan 5, 2014
1 parent c4f6258 commit c6a7e96
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 c6a7e96

Please sign in to comment.