- Don’t spend too much time on the prep work.
- Don’t spend too little time on the prep work.
If you spend too much time studying, you’ll never get to solve Leetcode/CTCI problems. Conversely, you’ll be lost if you spend too little time on the prep work. It is important that you spend the right amount of time for the prep work to make sure that you do not waste your time.
- Dynamic Array
- Linked List
- Stack & Queue
- Hash Tables
- Binary Search Tree https://www.youtube.com/watch?v=9Jry5-82I68 (MIT)
- Binary Heaps & Priority Queue
- Graphs
- Trie
https://medium.com/siliconwat/data-structures-in-javascript-1b9aed0ea17c -At a high level, there are basically three types of data structures.
- Stacks and Queues are array-like structures that differ only in how items are inserted and removed.
- Linked Lists, Trees, and Graphs are structures with nodes that keep references to other nodes.
- Hash Tables depend on hash functions to save and locate data.
- Bit Manipulation & Numbers — difference btw Unsigned vs signed numbers
- Stability in Sorting https://www.geeksforgeeks.org/stability-in-sorting-algorithms/
- Mergesort https://www.youtube.com/watch?v=Kg4bqzAqRBM https://www.geeksforgeeks.org/merge-sort/
- Quicksort https://www.tutorialspoint.com/data_structures_algorithms/quick_sort_algorithm.htm
- Heapsort — Sort it in-place to get O(1) space
- Binary Search
- Selections — Kth Smallest Elements (Sort, QuickSelect, Mediums of Mediums) — Implement all three ways https://medium.com/weekly-webtips/how-to-find-kth-largest-smallest-element-in-an-array-6d91286af3c7
- Permutations
- Subsets
- BFS Graph
- DFS Graph
- Dijkstra’s Algorithm (just learn the idea — no need to implement)
- Tree Traversals — BFS, DFS (in-order, pre-order, post-order): Implement Recursive and Iterative
- External Sort — No implementation; Just know the concept.
- NP-Complete (Video) — Just know the concept
- Topological Sort
- Detect cycle in an undirected graph
- Detect a cycle in a directed graph
- Count connected components in a graph
- Find strongly connected components in a graph
Once you are comfortable with the data structures & algorithms above, do the following exercise multiple times (at least 2–3 times) until you can do them with your eyes closed.
- Implement an ArrayList from scratch
- Reverse a linked list
- Implement a Stack & a Queue using Array
- Implement a HashTable with simple Hashing functions
- Implement a Graph using Adjacency List, and then write functions for BFS & DFS.
- Write the binary search algorithm both recursively and iteratively
- Write the merge sort algorithm
- Write the quicksort algorithm
- Print binary tree using DFS (in-order, preorder and post order — all three of them) and BFS.
- Memorize time & space complexities for common algorithms. Here’s an interesting website.
- Implement a trie.
- Learn these important bit manipulation tricks. https://www.geeksforgeeks.org/bit-tricks-competitive-programming/
- beiatrix https://www.youtube.com/playlist?list=PLu_sD_1ixKmhufvEeg2cCq4Wah7t3f91d
- Traversy Media https://www.youtube.com/watch?v=wtynhUwS5hI https://www.youtube.com/watch?v=ZBdE8DElQQU
- FCC https://www.youtube.com/watch?v=t2CEgPsws3U (data structures and algorithms)
- fCC (python, algorithms) https://www.freecodecamp.org/news/python-algorithms-for-job-interviews/
- Google engineer https://www.youtube.com/watch?v=RBSGKlAvoiM (data structures) https://www.youtube.com/watch?v=09_LlHjoEiY (algorithm)
- https://www.freecodecamp.org/news/best-books-data-structures-and-algorithms-javascript/
- https://www.geeksforgeeks.org/fundamentals-of-algorithms/#AnalysisofAlgorithms
- Data Structures - Intro to Computer Science - Harvard's CS50 (2018) https://www.youtube.com/watch?v=uTZFGXv798o
- Data Structures - Computer Science Course for Beginners https://www.youtube.com/watch?v=zg9ih6SVACc
- https://github.com/Hsien-HsiuLiao/javascript-algorithms-and-data-structures repository contains JavaScript based examples of many popular algorithms and data structures.Each algorithm and data structure has its own separate README with related explanations and links for further reading (including ones to YouTube videos). data structure readme has summary, Pseudocode for Basic Operations, time and space complexities. Algorithms sorted by topic, paradigm. Can run tests on data structures.