Techniques for Solving Data Structures Problems
Techniques for Solving Data Structures Problems with Examples
General
You can use a map (hash table) to decrease time-complexity by sacrificing space-complexity
Two pointer techniques
Middle point is n/2 where n is the length of the list
Arrays
Two pointers technique
Linked lists
1. Keep a dummy pointer
2. Slow runner runner and fast runner
3. Sentinel node doesn’t contain any value
4. Looping with linked list
5. Try to keep state outside the loop if needed , for example in reversing list
Last updated