r/learnpython • u/winterblute • 1d ago
Resources or techinques on learning and mastering algorithms?
It boggles me how people were able to master or visualize algorithms before the time of AI to break them down.
I wanted to know if the veterans here had any advice to help with visualizing or learning algorithms more efficiently?
1
u/ArmCollector 1d ago
Trying to implement (without ai) them is very useful for understanding them.
(source: PhD in Algorithms from 2006)
1
u/GuruPentameter 1d ago
having an intuition about solving problems independent of coding skill, i recommend books about computational thinking. eg, "Computational Thinking: A beginner's guide to problem-solving and programming"
1
u/chiibosoil 1d ago
Practice.
But having good understanding of data structure (data objects and how it behaves etc) along with logical problem solving skill will help.
First, try to breakdown problem into clear steps and path to get to the solution in plain English. If you can't explain it in words, most will find it difficult to code it.
Then apply appropriate data structure for optimized performance (ex: array, linked lists, stacks & queues, Hash tables/sets/maps, trees etc ) and use logics to reduce amount of computation required (minimize loop, use of mathematics etc).
Knowing Big O and time complexity analysis will help assess things as well.
1
u/acfot 1d ago
I'm still pretty early on algorithms myself so take this as a fellow learner, not a veteran. What actually helped me was picking one algorithm at a time and tracing it by hand on paper with a tiny example, like sorting five numbers, before I even touched code. Once I could see each step on paper the code made way more sense. I also try to implement it myself first without asking AI to explain it, because the moment I copy an explanation I think I get it and then forget it the next day. Not sure about the best visualizer out there since I mostly just use pen and paper, but slowing down and doing one small example by hand is what made it click for me.
1
u/Educational_Virus672 1d ago
first of all not all humans think the same it is easy for someone to build thier own way of learning by the middle of teenage though some may struggle
if you wanna build that same kind of memory i recommend not hoping for others method as direct copy instead try building notes and stuff that you use maybe put data in grid, use arrows or such. until you find what you like the most
note -this isnt same way they learn or not the best way either but it gets you there faster
1
u/Key_Net820 1d ago
Algorithms by Dasgupta.
Algorithms is a upper division course in university. Those of us who went to university have a huge head start on everybody else who were self taught. As a self taught programmer, even if you taught yourself about big O, you never went through formalizing it as a mathematical definition and you never proved inductively that an algorithm does converge in the big O time in question.
Furthermore, in algorithm theory, you do go in depth in a lot of the problems you see in leet code. You will actually prove theorems about combinatorics and number theory instead of just solving particular instances of them on leet code.
Finally algorithms are not particular to any specific language. So ya, people who study algorithms are gonna have a different feel to them than people who only self studied because algorithms at heart is a math independent from any one particular programming language.
1
u/ZeroYDELTA555 15h ago
The best approach that made algorithms click for me:
**Implement from scratch without libraries:** Don't just import or read theory. Implement basic sorting (merge sort), search, and graph traversal (BFS/DFS) manually in pure Python.
**Visualizer tools:** Use Python Tutor (pythontutor.com) or draw recursion trees on a physical notebook. Watching pointer movements step-by-step removes the abstraction barrier.
**Pattern recognition over quantity:** Focus on core patterns (Two Pointers, Sliding Window, Fast/Slow Pointer, Topological Sort) rather than grinding 300 random problems.
Understanding 15 core patterns thoroughly will solve 80% of problems you encounter.
1
u/TheRNGuy 8h ago
Find practical use for them so you see if they are better in specific cases than standard data types.
0
u/h00manist 1d ago
Before AI we had these things called books, courses, tutorials, study events, hackerspaces, story telling. These were the ways humans passed experience and knowledge to each other.
If you go to a old library maybe you could find some librarian that may still know about them.
AI nowadays keeps you in their bubble and doesn't tell you about these things.
You could also try a hackerspace.
4
u/lakseol 1d ago edited 1d ago
The first bit of advice is to not expect learning to happen quickly or easily. Computer programming is not a natural act and you have to practice to improve. It takes time and you have to accept that. You can't be like Neo, scan a tape and then say "I know Kung Fu". Learning to program is a bigger task than just learning a computer language, it takes time to collect and absorb all the small ideas that you come across. Peter Norvig explains this much better than I could:
https://www.norvig.com/21-days.html
Norvig is saying it's ten years to get to a very high level of performance, but in a much shorter time you can get to "proficient". Don't think "there's so much to learn, I can't do that". You can learn all that but you have to start and not give up before you really try. Plus you will find that you will forget things that you don't use regularly, which is normal. You never stop learning. I started programming many decades ago and I'm still learning.
The most important action is to get started.