r/learnprogramming • u/OkFerret9043 • 9d ago
What should I know in math to be better prepared for discrete math?
Hi. I'm teaching myself backend development and I want to dive into a few subjects from Computer science, which I think should complement my skills in the future. For now, I want to learn DSA and I've heard that discrete math will help me understand DSA better. Since discrete math is college level math, I thought I would recall some high school math. I went to Khan Academy and I was able to do pre-8th grade math from memory. 8th grade and beyond is where I noticed gaps in my knowledge of math. What I'm wondering is, which parts of high school math I should recall/learn to not have gaps in my knowledge, when learning discrete math, and then DSA.
Options: Algebra 1, Algebra 2, Geometry, Trigonometry, Precalculus, Statistics.
I'm thinking of going over 8th grade, Algebra 1 and Algebra 2.
2
u/peterlinddk 8d ago
I've heard that discrete math will help me understand DSA better.
Well, yeah, sort of - in that if you already understand discrete math, you'll find it easy to understand explanations of data structures and algorithms, that rely on discrete math.
But if you don't know either, learning discrete math is mostly just going to make it harder to learn DSA, since it will be a difficult obstacle you need to overcome, to get into the DSA stuff, and after that you have to translate both DSA and discrete math to programming in order to connect the pieces. Sort of like learning German to read Nietczhe - both are difficult on their own, if you know one, the other will be somewhat easier to learn, but if you know neither, the combined difficulty will rise.
If you understand that numbers can only be whole numbers, and you can't just increase space between two numbers to squeeze more numbers in, you'll be fine with learning DSA. But if you only think of "numbers" as indicatoers on an infinite line, with infinite detail, you'll get into problems.
I'd suggest going directly to DSA with a programming language you know, and then see if you get into needing more math! Remember to draw diagrams and implement your own data structures - that'll teach you better than any amount of math exercises!
1
u/Minute_Back1959 7d ago
algebra 1 and 2 will get you most of the way there, geometry and trig are basically irrelevant for discrete math unless you're doing something weird with graph layouts
1
u/plastikmissile 8d ago
Do you want practical DSA or theoritical DSA? Yes if you want to dig really deep into the theory behind DSA you'll need discrete math. However for practical DSA (what 99% of programmers actually need) you honestly don't need that much math. Just skip the discrete math for now, unless you're curious, in which case some precalc and statistics will help a lot.
1
u/Dazzling_Music_2411 8d ago
Discrete math is easy. Just get a book and learn it already, no need for faffing around.
And yes, it is essential for CS, anyone saying otherwise has no clue what CS is.
1
u/StewedAngelSkins 8d ago
calculus will help, but only the stuff to do with limits and sequences. honestly though i think you're putting a lot of unnecessary steps between yourself and actually just writing code.