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

22

u/Herpnasty11 Apr 05 '22

Quantum computer as a whole lol

17

u/faceplanted Apr 05 '22

For a non quantum explanation, quantum computers basically make one specific matrix operation O(1) so if you can convert your problem into one of those, you can speed up operations that that could normally take effectively forever on a conventional machine.

This is why cryptography is considered in danger if quantum computers become powerful, certain encryption algorithms rely on computers not being able to do certain operations quickly with large inputs, but we've shown that you can map those problems onto that operation quantum computers are good at. So rather than taking a billion years to decrypt, your message could take seconds/minutes/hours, even days would be far too fast, you need it to take millennia.

→ More replies (1)

6

u/hehehuehue Apr 05 '22

WIRED has a really good video on this

TLDW: Imagine a coin spinning constantly and not landing on either heads or tails, compared to binary where a coin MUST be either heads or tails.

6

u/evinrows Apr 05 '22 edited Apr 05 '22

But how do you solve a problem with that technology?

I know the answer is "something something every combination of people solutions at the same time," but at some point you have to collapse the quantum state. So how/when do you do that such that you get useful information back?

8

u/DONT_HACK_ME Apr 06 '22

You use algorithms that slightly change the system (but not collapse it) so that when you do measure the system, collapsing it, the correct solution is much more probable to be found than the incorrect solution.

Then you run the algorithm several times to verify what the correct solution was.

3

u/TangerineX Apr 05 '22

You can think of computers like marbles flowing through a large marble contraption. At the end of the contraption, there are several buckets. If your marble can flow through the contraption and land in some of the specific buckets, then we consider the program to return "true" and if not, the program returns "false".

Now instead of a bucket, what if it just leads to the start of another marble contraption. This is the basis of how functions work, we feed the results of functions into each other.

Now consider the case where we don't know exactly which functions we should use, or what data we should use to get our results. Imagine a scenario where the only thing we can do is try a huge number of combinations. In our marble example, we have a ton of input locations, and we have to find the right one to drop it.

So quantum computing is fast because what it allows us to do is simulate dropping the marble into all (or at least a lot) of the start location at once. Sure, a lot of them will fail, but we're only interested in the ones that succeed.

This is very very simplified explanation of how quantum computing as a whole, and I'm sure you can read more into it

→ More replies (1)
→ More replies (3)