Wednesday, January 20, 2016

Algorithm night (2): 10 questions to read

January 20, 2016

Plan to spend 2 hours (9pm - 12pm) to read 10 blogs about algorithms, each blog 10 minutes.

1.    Leetcode: Coin Change 
http://www.geeksforgeeks.org/dynamic-programming-set-7-coin-change/
Think about recursive function solution first, and then DP solution to remove redundant calculation

http://blog.csdn.net/kenden23/article/details/17636599
http://buttercola.blogspot.ca/2016/01/leetcode-coin-change.html

2.    Leetcode: Maximum product of word lengths 
https://www.hrwhisper.me/leetcode-maximum-product-of-word-lengths/


Brute force analysis, bit manipulation - encode string using integer, and then, optimize the algorithm - instead of two strings' comparison, using two integer bit manipulation - And operator - clever solution. 

5.    BFS - algorithm 
http://www.geeksforgeeks.org/find-number-of-islands/
Read the blog, understand the algorithm. Rate: 10

http://www.jiuzhang.com/solutions/find-the-connected-component-in-the-undirected-graph/

http://algobox.org/number-of-connected-components-in-an-undirected-graph/

9.   Leetcode: Longest increasing subsequence
http://blog.csdn.net/kenden23/article/details/17632821

spend 10 minutes to read the blog:
http://www.kancloud.cn/kancloud/data-structure-and-algorithm-notes/73075
http://www.geeksforgeeks.org/dynamic-programming-set-3-longest-increasing-subsequence/
Previous blog:
http://juliachencoding.blogspot.ca/2015/06/dynamic-programming-longest-increasing.html

Write some C# code for this algorithm later.

http://buttercola.blogspot.ca/2015/12/leetcode-longest-increasing-subsequence.html

NLogn solution, better than DP solution, Recursive solution
http://www.geeksforgeeks.org/longest-monotonically-increasing-subsequence-size-n-log-n/

Set Goals:
1. Know how to solve it using recursive solution first;
2. And then, understand DP solution, how to build the formula, avoid duplication;
3. And then, know where to find optimal solution here, O(nlogn),

10. Leetcode: Binary Tree Longest Consecutive Sequence

Excellent chance to practice recursive function
https://segmentfault.com/a/1190000003957798





No comments:

Post a Comment