I have programmed for several years. And I found it is always difficult to master an algorithm(What 'master' mean here is to understand how the algorithm works and could implement independently in some programming language).
I could implement some easy algorithms(such as bubble sort, binary search, basic graph traversal algorithms such as DFS, BFS, basic dynamic programming problems such as ). But it is very difficult for me to master some advanced algorithms such as KMP, max-flow.
I could understand the basic idea behind the algorithms. But I am usually stucked at implementation and forget the algorithm in a while.
So my questions are:
- what is a reasonable procedure to learn/master a new algorithm?
- Do I need practice it again and again in platform such as USACO, topcoder to master it? Or is there any better way?