1.bitwise
题集:http://rainykat.blogspot.com/2016/12/bit-manipulation.html
2. Recursion/Iteration
一旦到base case return的true/false值会一直return到出func
I like the following explanation for recursion
Complexity: tree解释Eg: counting # of nodes in binary tree. The basic idea of object oriented programming is that you trust objects to do the jobs they know the answers to. So if I'm a parent, I can count myself, and I let my children count themselves, and so forth.http://stackoverflow.com/questions/13756605/counting-the-nodes-in-a-binary-search-treeprivate int nodes(Entry<E> current) { // if it's null, it doesn't exist, return 0 if (current == null) return 0; // count myself + my left child + my right child return 1 + nodes(current.left) + nodes(current.right); }
This recursive function is in the standard form (T(n) = aT(n/b) + (-)(n) ) for master method http://en.wikipedia.org/wiki/Master_theorem. If we solve it by master method we get (-)(n) -- O(N) for tree traversal
A. Tree
题集: http://rainykat.blogspot.com/2016/12/leetcode-tree-recursive.html
B. Linked List
题集:http://rainykat.blogspot.com/2016/12/linkedlist-recursiveiterative.html
3. Binary Search (T(n) = T(n/2) + O(1). =>O(lgN))
适用于sorted array,mid = start + (end-start)/2; //!!!avoid limit error big integer
题集: http://rainykat.blogspot.com/2016/12/leetcode-binary-search.html
4. HashTable
题集: http://rainykat.blogspot.com/2016/12/hashmap.html
5.Dynamic Programming
就是每次运算的结果是建立在上一次运算结果的基础之上,在while/for loop里面
Time Complexity: O(cn) T(n) = T(n-1) + T(n-2) which is exponential.
题集: http://rainykat.blogspot.com/2016/12/leetcode-dynamic-programming.html
6.Back Tracking - GraphDFS
for loop 里面 call recursive function
题集: http://rainykat.blogspot.com/2016/12/leetcode-barktracking.html
7.BFS - Graph
题集:http://rainykat.blogspot.com/2017/01/bfs-graph.html
8. Union Find(主攻undriected graph, array boundry)
题集: http://rainykat.blogspot.com/2017/01/union-find.html
9. Two Pointers(多个来比较Array)
题集: http://rainykat.blogspot.com/2016/12/leetcode-array-two-pointer.html
10. 其他算法题
巧用各种data structure: stack - Deque, heap - PriorityQueue, 还有各种题
题集: http://rainykat.blogspot.com/2017/01/blog-post.html
11. 设计Desgin/ Class 集合
题集: http://rainykat.blogspot.com/2017/01/desgin.html
12. 解题常用Utility code
题集: http://rainykat.blogspot.com/2016/12/utility-code.html
Java&Js 代码整理(google drive) https://docs.google.com/document/d/1LWDEUkNAG7zlk8IQ_yBlIrly0evdP2wsCaVGTcnmn5c/edit?ts=58753f2a
13. 编程常识知识
题集: http://rainykat.blogspot.com/2016/12/blog-post_28.html
14. Algorithm Analysis
题集: http://rainykat.blogspot.com/2017/01/algorithm-analysis.html
No comments:
Post a Comment