Merge two sorted linked lists |  ; point to the last result pointer ; tricky : advance to point to the next " . next " field
function SortedMerge ( a , b ) { let result = null ; let lastPtrRef = result ; while ( 1 ) { if ( a == null ) { lastPtrRef = b ; break ; } else if ( b == null ) { lastPtrRef = a ; break ; } if ( a . data <= b . data ) { MoveNode ( lastPtrRef , a ) ; } else { MoveNode ( lastPtrRef , b ) ; } lastPtrRef = ( ( lastPtrRef ) . next ) ; } return ( result ) ; }