Skip to content

Conversation

@RohiniShankari
Copy link

This PR introduces a new reverse() method to the LinkedList class.
Functionality:

  • Reverses the order of nodes in the list in-place.
  • Handles edge cases: empty lists and single-node lists.
  • Iterates through the list, flipping the .next pointers of each node.
  • Returns the LinkedList instance for method chaining.
    Testing:
    Added comprehensive test cases for:
  • Normal multi-node lists
  • Empty lists
  • Single-node lists

All tests passed successfully.

@RohiniShankari RohiniShankari changed the title Added reverse() method to LinkedList with tests and TS types Added reverse() method to LinkedList Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant