Linked Lists seem so deceivingly easy. I remember learning about it during high school, and I loved the idea of the data structure. On the flip side, I hate circular linked lists. Not a fan. Also, never really used dummy ones. Cheers to my first day on linked lists.
Some notes:
- Finished linked lists
- What I learned is that a lot of linked list problems use two pointers: one fast and one slow to solve problems
- If not, reversing a linked list is a big help for problems as well
- Stacks in python are just lists with pop() and append()
- Queues can't use lists in python because we pop at index 0, which would require entire list to shift
- Use collections deque or queue.Queue
- Collections is more versatile because you can pop from both ends, acts as a stack, list, queue, anything really
- Most leetcode problems with LL will need two pointers, so start with that fact if you're ever lost.

No comments:
Post a Comment