function sortInList( head ) {     // write code here     if( head.next === null) return head     let arr = []     let p = head     while(p){         arr.push(p)         p = p.next     }     ...