Driver Code
root = new Node ( 5 ) ; root . next = new Node ( 2 ) ; root . next . next = new Node ( 2 ) ; root . next . next . next = new Node ( 7 ) ; root . next . next . next . next = new Node ( 2 ) ; root . next . next . next . next . next = new Node ( 2 ) ; root . next . next . next . next . next . next = new Node ( 2 ) ; var key = 2 ; document . write ( " " ) ; display ( root ) ; document . write ( " " ) ; root = keyToEnd ( root , key ) ; display ( root ) ;