Data Structures
1. Integer
– find number of 1s
– next largest smaller
– smallest larger number
– determine if is palindrom
– itoa, atoi
– add 2 numbers w/o using + or arithmetic operators
– implement *, -, / using only +
– find max of two numbers w/o comparison
– swap two numbers with +/-
– swap two numbers with ^
– given an integer, find the closest number that ispalindrome
– implement putlong() by putchar()
2. Bit array
3. Linked list
– find cycle,
– find position of cycle starts
– reverse LL
– delete a node in middle
– each node contains a value pointer pointing to anode,
duplicate LL.
– remove duplicates from sorted/un-sorted LL.
– find n-th to last node to end
– number is represented by LL, add 2 numbers
4. Array
– Longest common substring (LCSubstr)
– Longest common subsequence (LCS).
– Longest increasing subsequence (LIS).
– Longest palingdrome in string.
– array, elements are +/-, find subsequence of max sum
– circular array, elements are +/-, find subsequence of maxsum
– find all pairs of integers add up to a sum
– find all pairs of integers add up to asum,
integers are +/- and sorted
– find one missing number in N numbers in range [0, N]
– find two missing number in N numbers in range [0, N].
– binary search circular array
– Given {a1, a2, a3, ..}, {b1, b2, b3, …},
get {a1, b1, a2, b2, …}
– Given 2 arrays A and B, A large enough to holdboth,
merge B into A.
5. String
– KMP, Rabin-Karp, Boyer Moore
– reverse string
– reverse words in string
– strcpy, strcmp, strstr, atoi, itoa, strdup
– remove duplicate characters in O(1) space
– Given dictionary, transform one word to another of samelength.
– Given large text, find min cover distance of n words.
– find longest word made of other words
– find first non-repeated char
– remove specified char from a string
6. Matrix
– matrix elements are +/-, find submatrix of max sum
– rotate a matrix by 90 degrees
– each cell is black/white, find max subsquare with blackborder.
– binary matrix, find largest square matrix with 1s
– binary matrix, find largest rectangle matrix with1s
7. Stack
– implement stack by queue.
– augmented stack with O(1) push, pop, min
– use single array to implement 3 stacks
– sort a stack in ascending order usingonly
push/pop/top/isEmpty/isFull
8. Queue
– implement queue by 2 stacks
9. Priority Queue
10. Heap
– create heap on array
11. Young Tableau
– find element
– get k-th element
12. BST
– pre/in/post-order traversal, recursive and iterative
– pre/in/post-order traversal, recursive anditerative,
with parent pointer
– find height
– determine IsBST
– find "next" node of a given node in inorder sequence
– find k-th inorder element
– find range of elements
– find diameter
– find all path adding to a sum
– Check if a tree is balanced
– Convert sorted array into balanced BST
– Find first common ancestor of two nodes in a BT or BST
– Link each node to its right sibling
– Print by level (BFS)
– Print by level (BFS) in reverse order
– Determine if 2 BSTs have the same structure
– Create a mirror BT of a BT
– Replicate a linked structure
13. 2-3-4 Tree
14. Red-Black Tree
15. Splay Tree
16. AVL Tree
17. Trie
18. Suffix Array
19. SuffixTree
– LCSubstr (longest common substring)
– Longest repeated substring
– longest palindrome
– substring search
– data compression
20. B-Tree
21. KD Tree
22. Range Tree
23. Hash Table
24. Bloom filter
25. Disjoint set
26. Graph
– DFS, BFS
– find path existence between two nodes
– Min vertice set covering all edges
– shortest path
– minimum spanning tree
– min edge coverage by vertex
Sorting
1. Bubble sort
2. Insertion sort
3. Selection sort
4. Shell sort
5. Heap sort
6. Quicksort
7. Mergesort
8. N-way merge sort (externalsort)
9. Counting sort
10. Bucket sort
Search
1. Linear search
2. Binary search
– Binary search, iterative/recursive
– find missing number is sorted array
– search in circular sorted array
3. Quick Select
Dynamic programming
1. BST
2. COV
3. ILP
4. KS
5. LCS
6. LSP
7. MCM
8. ODP
9. SCP
10. SPA
11. SPC
12. TSP
13. Given array a[], when i < j,get max(a[i] – a[j]).
14. levenshtein edit distance
15. Coin Change problem.
Large-scale system
1. Bloom filter
2. Bit-array/bit-map
3. Heap
4. Hash table
– d-left hashing
5. Sub-division
6. Database indexing
7. Inverted index
8. External sort
9. Map-reduce
Discrete math, Probability and Statistics, NumericalComputation
1. Permutation
– 3 colors, how many ways to color a cube?
– robot, ways to go to diagonal corner on NxN matrix?
– print all combinations of valid n-pairs of parentheses
– print all subsets of a set
2. Combination
3. Sampling
4. Random numbergenerator
– What’s a good random number generator?
– Given random generator [1, 2, 3, 4, 5],
generate random in [1..7].
5. Reservoir sampling
6. Find median in stream
7. Card shuffling
8. Primality testing
9. Find prime numbers: naive,sieve of Eratosthenes, sieve of Atkin
10. Randomized primality testing, what’s goodrandom generator
11. Fibonacci sequence
12. Factorial numbers
13. Frobenous numbers
14. Newton-Ralphson algorithm
15. Bayes theorem
Computational algebra
1. Convex-hull
2. Closest pairs
Computational theory
1. Automata theory
2. DFA
3. NFA
4. Regular language
5. Pumping lemma
6. Turing machine
7. NP-completeness
1. TSP
2. Vertex-cover problem
3. Set-covering problem.
4. Subset-sum problem.
OS
1. Process and thread
2. Semaphore, mutex,monitor
3. Function call/callframe
4. Context switch
5. Multi-threading
6. Multi-process
7. Thread safety
8. Big/Little-endian
9. Heap/stack
10. Malloc/free
11. Virtual memory, page fault, thrashing
12. DMA (Direct Memory Access)
Networking
1. 7-layer OSI model
2. 4-layer TCP/UDP model
3. TCP/UDP
4. TCP 3-way handshake (ACKmachanism),
flow control, congestion control
5. Things happen afterentering url
6. Routing protocols: BGP,OSPF, RIP
7. Subnet mask, packet routingon same/different network.
8. Performance