Is there an "algebra" for algorithms?

That's why the Math students at my University struggle extremely with their mandatory little intro to CS course, which covers basic algorithm design principles, how to prove them and a bit of complexity theory. Just going by the statistics, it has the 2nd worst avg. grade and pass rate out of all courses in their mandatory first 2 years. The worst is a 2 semester abstract algebra course. The reasoning seems to be that they do not like to "stare at the problem until a possible solution pops up." Meanwhile CS students get filtered in the first year by two big rigorous algorithm courses.

But yeah, that's algorithms for you. There is much more trial & error involved than doing usual Mathematics. It's also why I love CS. Because it's a combination of rigorous proving your ideas, but to get to those ideas, you have to play around and try out many things. And learning how one algorithm works, doesn't give you always the right idea on how to tackle a seemingly related problem. Dynamic programming is also always a very good example that drives a huge divide, lol. But it's so powerful. With just a little bit of dynamic programming, you can go from naive O(2^n) fibonacci down to a O(n) fibonacci algorithm, and that one is just a very trivial example.

Then there's probabilistic, "online", streaming, distributed, security, approximation (ML), etc. algorithms that drive some of the concepts to insanity.

I love it.

/r/math Thread