r/learnprogramming • • Apr 05 '22

Name one programming/comp sci concept you never understood and if you understand it, try to explain it to them

Name a programming concept such as virtual functions, pointers, certain algorithms, etc that you always had a hard time understanding and why.

Someone else who reads yours and does understand it, try to explain it to them to help them learn

1.6k Upvotes

738 comments sorted by

View all comments

8

u/Patrickstarho Apr 05 '22

Ceaser Cipher. I get your supposed to shift each character by n but the whole modulus thing makes no sense to me. I remember I did the problem and wrote it out 10 times. 2 weeks later I was stuck again

3

u/Rote515 Apr 05 '22 edited Apr 05 '22

Modulo has to do with math in discrete finite sets rather than our traditional thinking of math done under infinite sets. So if we have a problem 2+x(where x is an integer) with no modulus then we are working with all integers both positive and negative from -infinity to infinity. If on the other hand we have the same problem mod 10, then we’re only working with numbers 0-9, a discrete set rather than the infinite set, as any equation mod 10 will always be 0<=x<10 as our function is divided by 10 at the end and the answer is the remainder after the division.

Understanding this, and discrete math in general is really helpful in programming as a lot of what we do is don’t over finite sets.

→ More replies (3)