Based on my learnings at Formation, I have learned 11 core algorithms for this Linked List data structure. I have grouped them up by similarities:
Group #1: Accumulating elements in a Linked List
- Count Elements in a Linked List
- Sum Element Values in a Linked List
Group #2: Finding without the need of a pointer
- Find a Highest/Max Element Value in a Linked List
- Find an Element in a sorted Linked List
Group #3: Finding with 2 pointers
- Find a Middle Element in a Linked List in One Pass
- Find Kth Element from the End of a Linked List in One Pass
Group #4: Adding element(s)
- Append an element with a target value to a Linked list
- Insert a target element in a sorted Linked List (with sentinel*)
Group #5: Removing element(s)
- Remove a target element in a sorted Linked List (with sentinel*)
- Remove all elements with a target value in a Linked List (with sentinel*)
Group #6: Reversing elements
- Reverse a Linked List
Group #7: Summing Linked Lists
- Sum Two Linked Lists of Equal Length (with sentinel*)
*Sentinel node = It is a node that does not hold any reference/data to a Linked List (can be any value). We will have the pointer points to this node first. This is especially commonly used for inserting and removing Linked List problems
Top comments (0)