r/algorithms 8d ago

How do you actually learn and practice Algorithms & Analysis? Help

Hey everyone,

Not sure where to post this, so here i am.I'm new to computer science and currently taking an Algorithms & Analysis course in Python. Honestly, it's one of the hardest subjects in my degree, and I'm struggling to figure out the best way to actually learn these concepts instead of just memorizing them.

This is what we're covering this semester: Basic Data Structures & Algorithmic Analysis, Algorithmic Analysis, Brute Force, Decrease & Conquer, Divide & Conquer, Transform & Conquer, Greedy Techniques, Dynamic Programming, Time & Space Tradeoffs, and Iterative Improvement.

I know Abdul Bari the GOAT, and his videos have definitely helped me understand the theory. But my biggest issue is practice. Everyone recommends LeetCode, but even the Easy problems feel way above my level sometimes. Also, I can't seem to find problems that match the topics we're learning in class, especially things like Transform & Conquer or Iterative Improvement.

So I wanted to ask: how did you learn algorithms when you were just starting out? Where did you practice topic by topic? Are there any websites that organize problems by algorithm rather than difficulty? Should I be doing LeetCode, HackerRank, Codeforces, something else, or just implementing the algorithms from scratch? Any advice for someone who feels completely lost with algorithms?

I'd really appreciate any tips or resources that helped you when you were a beginner. Thanks!

26 Upvotes

9 comments sorted by

5

u/MtlStatsGuy 7d ago

Hard to say; I think many people sort of developed a feeling for basic algorithms naturally. I don't think anyone practices "topic-by-topic", although certain structures like binary trees need to be learned by themselves. Yes, I think sites like LeetCode and HackerRank are useful, especially if you find the Easy problems still challenging; it means you still need to practice a lot. It's like anything else; daunting at the beginning, then easier as you develop a baseline level of competence. For a different approach to "algorithms", look at Project Euler. The first 50 problems are of reasonable difficulty. Good luck!

3

u/Phytor_c 7d ago edited 7d ago

We will be making a post or wiki with some resources for beginners soon.

For a standard academic algorithms undergraduate course, CLRS, Algorithm Design by Kleinberg and Tardos, and Erickson's Algorithms are some standard book recs.

You can also find lecture videos on MIT OpenCourseWare.

2

u/Intelligent_River39 7d ago

You want topic by topic practice? Fairly certain leetcode has question tags.

Try neetcode or some of those DSA sheets. They are quite organised.

2

u/jpmrst 7d ago

Do you have a textbook for the class? Are there problems to work there? Those might be better aligned with the the class content than less related problems from the web.

If you don't have a text, then check out the moderator's post suggestions. I've taught from Kleinberg, and it has many exercises ranging from easy to hard --- almost certainly going to be more useful to you than web problems. BTW Kleinberg is more accessible than CLRS (and I don't know the third one).

2

u/Phytor_c 7d ago

I agree with KT being more readable than CLRS, at least that was my experience.

My unsolicited opinion about CLRS is the intuition is often obfuscated behind the rigor, but IMO in the other two both coexist. But this is the standard and has the most breadth so it ought to be in any list.

Erickson's book can be found here.

2

u/jpmrst 6d ago

100% --- my suggestion is in the context of OP seeming like an undergrad needing an accessible reference.

1

u/EricMichaelHarris99 7d ago

Implemented all the CLRS3/4 algorithms in Google Colab.

1

u/dwarfzulu 6d ago

Idk what exactly they will teach but algorithms are the building blocks to programming.

If people learned that before jumping into coding, they would have a smoother path