Write an algorithm to reverse a linked list, both iteratively and recursively, and explain the space complexity of each.