Include the test-cases and the sketch of the algorithms for the common algorithm questions.
File Organization:
- basic: basic algorithms
- cc150: the problems in cracking the code interview
- dp: the popular dynamic programming problems, excluding the problems in cc150 and lc
- imagong: the problems on http://imagong.com/
- lc: the problems in leetcode
- recursive: the popular recursive problem, excluding the problems in cc150 and lc
#Problem List:
- binary search
- binary tree
- binary search tree (BST)
- +-*/ expression calculation
- bubble sort
- data structure that supports O(1) add, del, and getRandom
- counting sort
- find the kth smallest
- hashmap
- find primes in range of n
- heap sort
- insertion sort
- quick sort iterative
- quick sort recursive
- random shuffle
- selection sort
- subarray with sum zero
- union find
- all unique character
- reverse string
- whether one string is the permutation of the other
- replace blank space with '%20'
- run-length encoding
- rotate image in place
- set matrix zeros
- check string rotation using substring
- remove duplicate from unsorted linked list
- find the kth to the last from a singly linked list (needs improvement)
- delete the middle element from linked list (needs improvement)
- partition list
- add numbers
- detect the begining of the loop
- check whether a linked list is a palindrome (needs improvement)
- use an array to implement three stacks (not implemented)
- add 'push', 'pop', and 'min' operations for stack, all operations should be in O(1)
- set of stacks
- hanoi
- implement a queue with two stacks
- sort the elements in stack in ascending order
- animal shelter
- validate balanced binary tree
- check whether route exists in a directed graph (needs improvement)
- create minimal height binary tree
- traverse binary tree by level (needs improvement)
- validate binary search tree
- link the next sibling of binary tree
- lowest common ancestor (LCA)
- sub-tree matching
- find all paths in a binary tree that sum to a specific value (needs improvement)
- insert bits M into N
- represent double in binary
- next number with same number of 1
- number of bits different between A and B
- swap odd and even bits in an integer
- find missing number with fetch operation
- Choose game
- probability of collision
- line intersection
- implement -, *, / with + only
- find line that evenly cuts two squares
- line passes the most points
- find the kth number consists of 3, 5, 7
- climbing stairs
- unique paths
- find the magic index
- generate all permutations
- generate parenthesis
- paint fill
- find changes
- eight queens
- tallest stack