4 ms·
Just copy the addresses of each node in the list to an array. Then you can make copies of each node and reverse the copy in O(n) -- if you want to do it in O(n
by kenjackson 16y ago
Just copy the addresses of each node in the list to an array. Then you can make copies of each node and reverse the copy in O(n) -- if you want to do it in O(n) out-of-place.