I am trying to implement the linkedList class, adding a method reverse(int n) to reverse the linked list. For example, I have a linked list { A -> B -> C -> D -> E). When I call reverse(4), the linked list will become D-->C-->B-->A-->E.
I am trying to avoid using iterator, constructing new node and copying the data value. Does anyone have idea how to do it? I know there was a post about reversing linked list but that one is reversing the entire linked list.
Thank you so much for the help!