3 ms·
I like algorithms and data structures. One of the thing I, personally, find hard about Algos and DS, is that I don't know when to use which. For example, I coul
by rrgok 4y ago
I like algorithms and data structures. One of the thing I, personally, find hard about Algos and DS, is that I don't know when to use which. For example, I could never ever come up with my own, that the traveling salesman problem can have a good solution with ant colony optimization or simulated annealing. How do I learn that skill? I still don't know when to use a graph for what kind of problem.
I hope someone can shed some light on this.
- Jensson 4y agoYou get good at this from a long life of curiosity in the subject. Basically, if you spent your life testing many different ways to do things, think thousands of different ways to compute or parse or view data etc, then you have that huge knowledge bank to aid you when you see a new problem, so you compose a few of those things to solve it. It is the same process as learning the elementary algebra in math. You learn a few basic techniques, like moving numbers and variables from one side to the other, and then you compose those to solve expressions you haven't seen before. The only difference is that algorithms is a much larger space, there are way more techniques and problems there so it takes longer to get to a point where it is useful to you.
- jpitz 4y agoThe Algorithm Design Manual, which maybe should have been named The Algorithm Selection Manual. https://www.goodreads.com/book/show/425208.The_Algorithm_Design_Manual https://www.goodreads.com/book/show/425208.The_Algorithm_Des...
- TheEndIsNigh 4y agoYou need to solve hard problems. Code Jam is an amazing source for this. Just don't expect to knock them out in 5 minutes. Pick a hard problem and stay a week with it trying different ideas and compare the time complexity.
- djur 4y agoSo far most of the resources I've found for this kind of thing don't really provide enough guidance in what algorithms to choose and why, mostly because they're usually designed as competitions. I'm not interested in competing with other programmers, I want to learn from them.
- TheEndIsNigh 4y agoBecause guidance can't be given its learned. You don't have to compete. Go on LC and try various approaches compare time-complexities and it will be obvious why you have to use a certain algorithm.