import { List , ListNode } from './LinkList' ; param { ListNode } pHead param { ListNode } qHead return { List } function MergeList ( pHead , qHead ) { let list = new List ( ) ; if ( ! pHead ) { list . head = qHead ; return list ; } else if ( ! qHead ) { list . head = pHead ; return list ; } let node = list . head ; while ( pHead && qHead ) { if ( pHead . val < qHead . val ) { node . next = pHead ; pHead = pHead . next ; } else { node . next = qHead ; qHead = qHead . next ; } node = node . next ; } if ( ! pHead ) { node . next = qHead ; } else { node . next = pHead ; } list . head = list . head . next ; return list ; } export default MergeList ;