YandereDev's blog

By YandereDev, history, 3 years ago, In English

I'm new to competitive programming and I'm wondering if you guys memorize or write down the algorithms that you learned. Thanks for the answer.

  • Vote: I like it
  • +12
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Auto comment: topic has been updated by YandereDev (previous revision, new revision, compare).

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I often memorize them, but sometimes I face a beautiful problem with strange observations, such as 1473G - Tiles, I will write it down and keep it in a notebook, so I can read it everywhere~

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

The first thing is you need to understand the whole details of each step of the algorithm that how it works and why it works. Then the next step involves to solve problems that use that particular algorithm. Hence this way, you again and again write down the code for the same algorithm such that it becomes your muscle memory which is the desired outcome.

For sure, this would not happen in just first/second try. Lets take an example of binary search. maybe for the first time you may write the never terminating loop. But this would for sure improve each time you write the code for it.

So, in short we do memorize and write down the algorithms we have learned. Wish you luck forward :)

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

All you need is logic. I was using kadane's algorithm even before I know there is a algorithm names kadane. Same with greedy and dynamic programming algorithms. Don't decide which algorithm to use just approach the solution with most basic logic you can think. You will be surprised to see that you used DFS, binary search and many other algorithms unknowingly.

»
3 years ago, # |
Rev. 2   Vote: I like it +25 Vote: I do not like it

I understand them way more often than just memorizing... the only data structure/algorithm I remember memorizing and not understanding how it works for a long time was fenwick tree. There are other things like simplex that I don't understand how it works but that's not commonly used at all so it didn't come into mind when first writing this comment.