Want to improve at algorithms? Build your own tools
Posted by Repulsive-Win7189@reddit | learnprogramming | View on Reddit | 6 comments
When i say “tools”, i don’t mean enter 2 values and sum them. No, i mean something that handles computational problems such as your own interpreter for a custom database, building anything that deals with time and conflict handling, scheduling, a custom code editor, etc.
Building a REST API isn’t going to improve these skills since they’re completely different (tho, you can still run into complexity with middleware and authentication).
I say this from my own experience building these tools. Here are examples of how it helped me:
Building an interpreter for my custom database helped me to understand FSMs, making this problem trivial: https://leetcode.com/problems/string-to-integer-atoi/
Building the event overlap handling with my scheduler made this trivial: https://leetcode.com/problems/merge-intervals/
It’s a good challenge and it really teaches you the fundamentals of problem solving and software development.
FlashyResist5@reddit
Depends on what your goals are. Learning those concepts directly is going to be way faster than building an interpreter and a custom database so that you can learn them as a byproduct.
It smacks of the same energy as don't learn calculus, just invent physics from scratch and then you will know calculus.
Repulsive-Win7189@reddit (OP)
Obviously you should still study Algorithms (I would never suggest otherwise), but I find the grinding of problems afterwards to be not really that useful when there are other ways to improve those skills.
No Algorithms course in a university worth its salt is going to just say, "Hey, grind these LC problems." No, they're going to teach theory, have you write it, and ideally work on a real problem that utilizes the concepts.
And if you dive into books such as CLRS or Art of Computer Programming, you'll see that the problems are much more involved than just "Solve 2 Sum". So, my point still stands.
FlashyResist5@reddit
If you ask competitive programmers how they prepare for competitions I highly doubt they are going to say they build custom databases and interpreters. They are grinding problems.
Repulsive-Win7189@reddit (OP)
Is the average person who is pursuing a job need to be a competitive programmer?
Also, I believe there are multiple ways to achieve proficiency (in the same way there are multiple ways to learn a language). Sure, you can grind 3000+ problems on LeetCode and have no life. Or, you could work on relevant topics in projects to attain both theoretical grasp as well as improve your problem solving overall.
ElegantObligation196@reddit
Actually building stuff instead of just grinding leetcode problems makes so much sense. When I was working on collision detection for a small game project, interval trees suddenly clicked in way that no amount of practice problems could teach
The scheduler example is spot on - once you've dealt with real overlapping events and edge cases, those merge interval problems become almost automatic
Repulsive-Win7189@reddit (OP)
Right? When I first saw the interval problems, I was like, "Oooo, spooky". But, working on real problems genuinely helps internalize the concepts so much better.
I fundamentally believe that working with time is one of the best ways to learn computational thinking since it truly is a pain in the butt lol