import { LinkedList , LinkedListNode } from '../linkedList/linkedList' ; /**
 * Reverse a linked list in place
 * Space: O(1)
 * Time: O(n)
 */ export function reverseLinkedList < T > ( list ) { let previous = null ; let current = list . head ; while ( current != null ) { let next = current . next ; current . next = previous ; previous = current ; current = next ; } [ list . head , list . tail ] = [ list . tail , list . head ] ; }