4 ms·
It's common to be bored studying material that you have no background in, and no motivation for. These things seem unmotivated, disconnected, and completely ar
by ColinWright 13y ago
It's common to be bored studying material that you have no background in, and no motivation for. These things seem unmotivated, disconnected, and completely arbitrary.
In general, I find the best way to study these sorts of things is to have a puzzle to solve, to work through it, and then have a mentor demonstrate a little piece of magic that makes me feel stupid for not having thought of it. Here's an example that you may not know, but most people here will.
In the Pollard Rho method of factoring you compute f(x) repeatedly, and need to find somewhere that it repeats. So you start with x[0] = x0, then compute x[n+1]=f(x[n]). Question - find i and j such that x[i]=x[j].
You can think of this as an implicit linked list between integers, and you're given a starting point and asked to find a loop. How can you do this with fixed, limited additional storage?
Yes, there is an algorithm to do that.
Here's another. Suppose you have a vector of key/value pairs and you need to sort on the key. More, if two keys are equal, their positions in the result must be the same as their positions in the original. Can you do that? Many library sorts don't offer that option - can you find a way?
Having found some of these sorts of problems in the real world and puzzled over them, only to find that (a) they've been done, (b) they've been done better than you thought possible, and (c) there is a touch of magic about the answer, then you might become more engaged with the topic.
Otherwise, maybe the job isn't really for you.
- lifeisstillgood 13y agoAgreed - context matters, as does having banged your head for hours and then finding a better route, by people who banged their heads for days some years ago. What's even better is the repeat - where you smile and realise there is no head banging needed :-)
- resdirector 13y agoHi Colin, thanks for your advice. Especially: > In general, I find the best way to study these sorts of things is to have a puzzle to solve, to work through it, and then have a mentor demonstrate a little piece of magic that makes me feel stupid for not having thought of it (Actually, I could quote your entire comment, thanks, very much appreciated!)