A complete implementation of a generic singly linked list data structure with advanced operations.
-
Core Operations:
- Add/remove at head, tail, or any position
- Get elements by position (from start or end)
- Convert to array
- List cloning
-
Advanced Operations:
- Loop detection (Floyd's Cycle-Finding Algorithm)
- Loop removal
- List reversal (recursive)
- Merge two linked lists
- Find middle node (fast/slow pointer technique)
-
Utility Methods:
size(),isEmpty(),contains()indexOf(),lastIndexOf()print_list()-> (you can also implement object.toString() with the help of StringBuilder and print object instead)