Write an algorithm for reversing a Linked List.
Implement def reverse_linked_list(head): using singly linked-list nodes. The function must return the new head after reversing the list in place.
For grading, linked lists are represented as arrays of node values in examples and test cases, where [] represents a null head. Return the reversed list through its node sequence. Use constant auxiliary space.
def reverse_linked_list(head):