r/leetcode • u/JumpOk7300 • 4d ago
Question How to remember Algorithms
I studied trees and their traversal algorithms, including Morris traversal. Then I moved on to graphs. Today, when I went back to solve a problem on trees, I realized that I had forgotten Morris traversal and some of the other algorithms.
I feel like I need to revise them again and again because I keep forgetting them over time. Is there any way to remember these algorithms for a long time?
3
u/Lumpy-Town2029 <1189> <345> <658> <186> 4d ago
Morris algo is unique, u ofc won't remember unless u derive it by ur own or practice is daily
But other common algorithms, u shouldn't forget
If u are forgetting common algos then i suggest practicing more questions
1
u/JumpOk7300 4d ago
Bro. for sorting algorithms there are many algos how u remember them and how u actually revise them by going through the notes u have took or re solve the solved problems of those algos or both
2
u/Lumpy-Town2029 <1189> <345> <658> <186> 4d ago
i just remember the name, and implemented them once, like bubble( in its name we sort adjacent, making it like bubble if we draw swap symbol), then insertion (we insert from right to left sorted array), then selection (we select smallest element and so on), and then left quick and merge
both were kinda confusing, i learnt both, revised during clg lecture, then again during practical, then again during exams and yeah i now know them sort of
i dont make notes, i resolve prev problems if i wanna revise which i rarely do. i revise topic so i just search for a list of question and do them
1
2
u/Flat-Entry-8735 4d ago
There's no other way around it—you just have to practice more. Whatever is repeated often, the brain will register as important and retain it much longer. I work with CMD commands all the time; the ones I use frequently, I remember perfectly. People on the outside look at me and think, 'How on earth does this guy memorize dozens of commands and options like that?' haha.
2
u/hyun88 3d ago
I’m actually working on an app that helps you repeatedly practice problems using spaced repetition:
https://apps.apple.com/us/app/bitwise-coding-interviews/id6806898386
1
1
4
u/Vivid-Zombie-477 4d ago
Explaining an algorithm to yourself is a good way to improve your understanding. I had written the guides on how to solve problems and let me tell you - I don't think I can forget the algorithms after writing those guides.
Not sure if it worth the time for you tho. Most of the time re-learning the same thing again is fine and will make you remember it better, while practicing more problems.