Driver code
let head = new Node ( ' ' ) ; head . next = new Node ( ' ' ) ; head . next . next = new Node ( ' ' ) ; head . next . next . next = new Node ( ' ' ) ; head . next . next . next . next = new Node ( ' ' ) ; head . next . next . next . next . next = new Node ( ' ' ) ; head . next . next . next . next . next . next = new Node ( ' ' ) ; head . next . next . next . next . next . next . next = new Node ( ' ' ) ; document . write ( " " ) ; printlist ( head ) ; head = arrange ( head ) ; document . write ( " " ) ; printlist ( head ) ;