I have two different ideas to learn algorithms, but I can't find out which one is best and faster for learning:
1 — Learn a specific algorithm then try to solve the related problems .
2 — Try solving random problems and then try to learn the algorithm that can solve this problem .
And any other ideas to make the learning more efficient?