by simpaticoder · 1y ago · 0 comments
Memorization is not a panacea. I never found memorizing l33t code problems to be edifying. I think it's because those kinds of tight, self-referential, clever programs are far removed from the activity of writing applications. Most working programmers do not run into a novel algorithm problem but once or twice a career. Application programming has more the flavor of a human-mediated graph-traversal, where the human has access to a node's local state and they improvise movement and mutation using only that local state plus some rapidly decaying stack. That is, there is no well-defined sequence for any given real-world problem, only heuristics.
I remember being given a proof of why RSA encryption is secure. All the other students just regurgitated it. It made superficial sense I guess.
However, I could not understand the proof and felt quite stupid. Eventually I went to my professor for help. He admitted the proof he had given was incomplete (and showed me why it still worked). He also said he hadn't expected anyone to notice it wasn't a complete proof.
I think you two are agreeing. GP said that they found they couldn't memorize something until they actually understood it
> I find it hard to memorise things I don't actually understand.
Isn't it the parent's point?
With what assumptions?
There are some other things you have to worry about practically, e.g Coppersmith's attack, and padding schemes (although that wasn't part of the proof I was given)
Only when I got late twenties, I realized how wrong he was. Memorization and understanding go hand in hand, but if one of them has to come first than it's memorization. He probably said that because that was what kids (who were forced to do rote memorization) wanted to hear.
Sort of like how most of the trigonometric identities that kids are made to memorize fall out immediately from e^iθ = cosθ+isinθ (could be taken as the definitions of cos,sin), e^ae^b=e^(a+b) (a fact they knew before learning trig), and a little bit of basic algebraic fiddling.
Or like how inverse Fourier transforms are just the obvious extension of the idea behind writing a 2-d vector as a sum of its x and y projections. If you get the 2d thing, accept that it works the exact same in n-d (including n infinite), accept integrals are just generalized sums, and functions are vectors, and I guess remember that e^iwt are the basis you want, you can reason through what the formula must be immediately.
Memorization is more like a shortcut. You don't need to go through the problem solving process to know the result. But with understanding, you master the heuristic factors needed to know when to take the shortcut and when to go through the problem solving route.
The Dreyfus Skill Model [0] is a good explanation. Novice typically have to memorize, then as they master the subject, their decision making becomes more heuristic based.
LLMs don't do well with heuristics, and by the times you've nailed down all the problems data, you could have been done. What they excels at is memorization, but all the formulaic stuff have been extracted into frameworks and libraries for the most popular languages.
[0]: https://en.wikipedia.org/wiki/Dreyfus_model_of_skill_acquisi...
If you're trying to expand polynomials and you constantly have to re-derive multiplication from first principles, you're never going to make any progress on expanding polynomials.
> "Just memorize it, it'll make your life so much easier."
That is because you evaluate cost of memorization to 0, because someone else is paying it. And you evaluate the cost of making mistakes due to constantly forgetting and being unable to correct to 0, because simply the kid gets blamed for not having perfect memory.
> or translate a language when they haven't memorized the vocabulary words in the lesson so they have to look up each one
Teaching language by having people translate a lot is an outdated pedagogy - it simply did not produced people capable to understand and produce the language. If the kids are translating sentences word by word, there was something going on wrongly before.
As someone who never learned my multiplication tables – it’s fine. I have a few cached lookups and my brain is fast at factoring.
8*6? Oh that’s just 4*2*6= 4*12 = 48. Easy :)
maybe they pay hits a reward centre in my brain.
Can I derive these from first principles? Sure, but after not seeing it for years, it might take me 10+ minutes to think through everything and correct any mistakes I make in the derivation.
But if I start with the formula? Takes me 5 seconds to sanity check the combination formula, and maybe 20 to sanity check the permutation formula. Just reading it to myself in English slowly is enough because the justification kind of just falls right out of the formula and definition.
So, yeah, they go hand in hand. You want to understand it but you sure as heck want to memorize the important stuff instead of relying on your ability to prove everything from ZFC...
You need to memorize it to use it subconsciously while solving more complex problems. Other ways you won't fit more complex solutions into your working memory,vso whole classes of problems will be too hard for you.
As you discovered: A properly structured memorization of carefully selected real world material forces you to come up with tricks and techniques to remember things. With structured information (proofs in your case) you start learning that the most efficient way to memorize is to understand, which then reduces the memorization problem into one of categorizing the proof and understanding the logical steps to get from one step to another. In doing so, you are forced to learn and understand the material.
Another controversial take (for HN, anyway) is that this is what happens when programmers study LeetCode. There’s a meme that the way to interview prep is to “memorize LeetCode”. You can tell who hasn’t done much LeetCode interviewing if they think memorizing a lot of problems is a viable way to pass interviews. People who attempt this discover that there are far too many questions to memorize and the best jobs have already written their own questions that aren’t out of LeetCode. Even if you do get a direct LeetCode problem in an interview, a good interview will expect you to explain your logic, describe how you arrived at the solution, and might introduce a change if they suspect you’re regurgitating memorized answers.
Instead, the strategy that actually works is to learn the categories of LeetCode style questions, understand the much smaller number of algorithms, and learn how to apply them to new problems. It’s far easier to memorize the dozen or so patterns used in LeetCode problems (binary search, two pointers, greedy, backtracking, and so on) and then learn how to apply those. By practicing you’re not memorizing the specific problems, you’re teaching yourself how to apply algorithms.
Side note: I’m not advocating for or against LeetCode, I’m trying to explain a viable strategy for today’s interview format.
1. Represent different objects in the room as some form of machine understandable form in a matrix 2. Find the number of Islands or find the Islands themselves.
I still don’t like leetcode, though.
Memorizing multiplication tables is the first place many children encounter this strategy: The teacher shows you that you could try to memorize all of the combinations, or you could start learning some of the patterns and techniques. When multiplying by 5 the answer will end in 0 or 5. When multiplying by 2 the answer will be an even number, and so on.
Anecdotally (I only worked with math students as a tutor for a couple years), that math requires a lot of the boring type of memorization seems to be a really widespread misunderstanding.
Code-wise, I spent a lot of time in college reading other people's code. But no memorization. I remember David Betz advsys, Tim Budd's "Little Smalltalk", and Matt Dillon's "DME Editor" and C compiler.
It is What you memorize that is important, you can't have a good discussion about a topic if you don't have the facts and logic of the topic in memory. On the other hand using memory to paper over bad design instead of simplifying or properly modularizing it, leads to that 'the worst code I have seen is code I wrote six months ago' feeling.
There is also something to the practice of reproducing something. I always took this as a form of "machine learning" for us. Just as you get better at juggling by actually juggling, you get better at thinking about math by thinking about math.
Instead, I wished it showed how the sausage was actually made in the original writings of galois [1]. This would have been far more interesting to students, as it showed the struggles that went into making the product - not to mention the colorful personality of the founder.
The history of how concepts were invented for the problems faced is far more motivating to students to build a mental model than canned capsules of knowledge.
> The history of how concepts were invented for the problems faced is far more motivating to students to build a mental model than canned capsules of knowledge.
That's something I really like about 3blue1brown, and he says it straight up [0]:
> My goal is for you to come away feeling like you could have invented calculus yourself. That is, cover all those core ideas, but in a way that makes clear where they actually come from, and what they really mean, using an all-around visual approach.
Ofc you could also say that's for the student to find out, but I've had other things on my mind
If it doesn’t work for you on l33t code problems, what techniques are you finding more effective in that case?
As a concrete example, there is a class of problems that are well served by dynamic programming. So we would review specific examples like Dijkstra's algorithm for shortest path. Or Wagner–Fischer algorithm for Levenshtein-style string editing. But we would also learn, often via these concrete examples, of how to classify and structure a problem into a dynamic programming solution.
I have no idea if this is what is meant by "l33t code solutions", but I thought it would be a helpful response anyway. But the bottom line is that these are not common in industry, because hard computer science is not necessary for typical business problems. The same way you don't require material sciences advancements to build a typical house. Instead it flows the other way, where advancements in materials sciences will trickle down to changing what the typical house build looks like.
Memorization of l33t code DOES work well as prep for l33t code tests. I just don't think l33t code has much to do with application programming. I've long felt that "computer science" is physics for computers, low on the abstraction ladder, and there are missing labels for the higher complexity subjects built on it. Imagine if all physical sciences were called "physics" and so in order to get a job as a biologist you should expect to be asked questions about the Schroedinger equation and the standard model. We desperately need "application engineering" to be a distinct subject taught at the university level.
That's a real major that's been around for a couple of decades which focuses on software development (testing, version control, design patterns) with less focus on the more theoretical parts of computer science? There are even specialties within the Software Engineering major that focus specifically on databases or embedded systems.
This may be true of mathematical proofs, but it surely must not be true in general. Memorizing long strings of digits of pi probably isn’t much easier if you understand geometry. Memorizing famous speeches probably isn’t much easier if you understand the historical context.
Not commenting on the merits of critical thinking vs memorization either way, but I think it would be meaningfully easier to memorize famous speeches if you understand the historical context.
The professor explained things, we did proofs in class, we had problem sets, and then he gave us open-book semi-open-professor take-home exams that took us most of a week to do.
Proof classes were mostly fine. Boring, sometimes ridiculously shit[0], but mostly fine. Being told we have a week for this exam that will kick our ass was significantly better for synthesizing things we'd learned. I used the proofs we had. I used sections of the textbook we hadn't covered. I traded some points on the exam for hints. And it was significantly more engaging than any other class' exams.
[0] Coming up with novel things to prove that don't require some unrelated leap of intuition that only one student gets is really hard to do. Damn you Dr. B, needing to figure out that you have to define a third equation h(x) as (f(x) - g(x))/(f(x) + g(x)) as the first step of a proof isn't reasonable in a 60 minute exam.
Whether leet code or anything else.
A dominant majority in public schools starting late 1970s seems to follow the "Lying to Children" approach which is often mistakenly recognized as by-rote teaching but are based in Paulo Freire's works that are in turn based on Mao's torture discoveries from the 1950s.
This approach contrary to classical approaches leverages torturous process which seems to be purposefully built to fracture and weed out the intelligent individual from useful fields, imposing sufficient thresholds of stress to impose PTSD or psychosis, selecting for and filtering in favor of those who can flexibly/willfully blind/corrupt themselves.
Such sequences include Algebra->Geometry->Trigonometry where gimmicks in undisclosed changes to grading cause circular trauma loops with the abandonment of Math-dependent careers thereafter, similar structures are also found in Uni, for Economics, Business, and Physics which utilize similar fail-scenarios burning bridges where you can't go back when the failure lagged from the first sequence, and you passed the second unrelated sequence. No help occurs, inducing confusion and frustration to PTSD levels, before the teacher offers the Alice in Wonderland Technique, "If you aren't able to do these things, perhaps you shouldn't go into a field that uses it". (ref Kubark Report, Declassified CIA Manual)
Have you been able to discern whether these "patterns" as you've called them aren't just the practical reversion to the classical approach (Trivium/Quadrivium)? Also known as the first-principles approach after all the filtering has been done.
To compare: Classical approaches start with nothing but a useful real system and observations which don't entrench false assumptions as truth, which are then reduced to components and relationships to form a model. The model is then checked for accuracy against current data to separate truth from false in those relationships/assertions in an iterative process with the end goal being to predict future events in similar systems accurately. The approach uses both a priori and a posteriori components to reasoning.
Lying to Children reverses and bastardizes this process. It starts with a single useless system which contains equal parts true and false principles (as misleading assumptions) which are tested and must be learned to competency (growing those neurons close together). Upon the next iteration one must unlearn the false parts while relearning the true parts (but we can't really unlearn, we can only strengthen or weaken) which in turn creates inconsistent mental states imposing stress (torture). This is repeated in an ongoing basis often circular in nature (structuring), and leveraging psychological blindspots (clustering), with several purposefully structured failings (elements) to gatekeep math through torturous process which is the basis for science and other risky subject matter. As the student progresses towards mastery (gnosis), the systems become increasingly more useful. One must repeatedly struggle in their sessions to learn, with the basis being if you aren't struggling you aren't learning. This mostly uses a faux a priori reasoning without properties of metaphysical objectivity (tied to objective measure, at least not until the very end).
If you don't recognize this, an example would be the electrical water pipe pressure analogy. Diffusion of charge in-like materials, with Intensity (Current) towards the outermost layer was the first-principled approach pre-1978 (I=V/R). The Water Analogy fails when the naive student tries to relate the behavior to pressure equations that ends up being contradictory at points in the system in a number of places introducing stumbling blocks that must be unlearned.
Torture being the purposefully directed imposition of psychological stress beyond a individuals capacity to cope towards physiological stages of heightened suggestability and mental breakdown (where rational thought is reduced or non-existent in the intelligent).
It is often recognized by its characteristic subgroups of Elements (cognitive dissonance, a lack of agency to remove oneself and coercion/compulsion with real or perceived loss or the threat thereof), Structuring (circular patterns of strictness followed by leniency in a loop, fractionation), and Clustering (psychological blindspots).
The classical approach used charge diffusion iirc, and you can find classical examples of this in Oliver Heaviside's published works (archive.org iirc). He's the one that simplified Maxwell's 20+ equations down to the small number we use today.
Can you provide some concrete examples of it?
I think there is validity to the approach but sciences would be much, much improved if taught more like history lessons. Here is how we used to think about gravity, here's the formula and it kind of worked, except... Here is planetary orbits that we used to use when we assumed they had to be circles. Here's how the data looked and here's how they accounted for it...
This would accomplish two goals - learning the wrong way for immediate use (build on sand) and building an innate understanding of how science actually progresses. Too little focus is on how we always create magic numbers and vague concepts (dark matter, for instance) to account for structural problems we have no good answer for.
Being able to "sniff the fudge" would be a super power when deciding what to write a PhD on, for instance. How much better would science be if everyone strengthened this muscle throughout their educatuon?
Also, In Algebra I've seen a flawed version of mathematical operations being taught that breaks down with negative numbers under multiplication (when the correct way is closed over multiplication). The tests were supposedly randomized (but seemed to target low-income demographics). The process is nearly identical, but the answers ultimately not correct. The teachers graded on the work to the exclusion of the correct answer. So long as you showed the correct process expected in Algebra you passed without getting the right answer. Geometry was distinct and unrelated, and by Trigonometry the class required correct process and answer. You don't find out there is a problem until Trigonometry, and the teacher either doesn't know where the person is failing comprehension, or isn't paid to reteach a class they aren't paid for but you can't go back.
I've seen and heard horror stories of students where they'd failed Trig 7+ times at the college level, and wouldn't have progressed if not for a devoted teacher helping them after-hours (basically correcting and reteaching Algebra). These kids literally would break out in a cold PTSD sweat just hearing the associated words related to math.
Off the top of my head, the former includes reasoning under dialectical (priori and later posteriori parts under the quadrivium).
Its a bit much to explain it in detail in a post like this but you should be able to find sound resources with what I've provided.
It largely goes back to how philosophy was taught; all the way back to Socrates/Plato/Aristotle, up through Descartes, Locke (barely, though he's more famous for social contract theory), and more modern scientists/scientific method.
The way math is taught today, you basically get to throw out almost everything you were taught at various stages, and relearn it anew on a different foundation, somehow fitting the fractured pieces back together towards learning the true foundations, which would be much easier at the start and building on top of that instead of the constant interference.
You don't really end up understanding math intuitively nor its deep connections to logic (dialectics, trivium), until you hit Abstract Algebra.