1463 points · by bdr · 7y ago · 238 comments
Professor Erickson, if you're reading this, thank you for being the best educator of my college days and for making your beautifully-written notes available to everyone.
That’s brilliant, yet I’ve never heard of it. Should be standard scoring for written exams.
I would also grade all exams the first time blind to who the student was and then regrade a half dozen again to make sure that I hadn’t drifted out of grade over the marking process.
I used to play an game with myself (marking is very boring) as to who would get what mark based on my in class knowledge of the student (when you run labs you do get to know the individual students). It was a rare student that got a exam mark more than 10% outside my estimate.
You had to be rather certain that you were sufficiently wronged overall, otherwise a few points more on one question could be offset by a large number of negated points from other questions where the professor thought that the TA might have been too generous.
Then again, the teachers that did it seemed like they were doing it punitively (e.g. subtracting the exact amount of points they were forced to add.)
One other time, I asked the lecturer (different paper) where I went wrong on a question, and turn's out I was right all along, got that question regraded without the potential downside to a full remark.
As usual, answering any (sub)problem with “I don’t
know” (and nothing else) is worth 25% partial credit.
Yes, even for problem 1. Correct, complete, but
suboptimal solutions are always worth more than 25%.
A blank answer is not the same as “I don’t know”
[0] http://jeffe.cs.illinois.edu/teaching/algorithms/hwex/s18/fi...Sounds sensible to me.
His approach to demystifying recursion is perfect (Chap 1.2): "The Recursion Fairy will solve all the simpler subproblems for you, using Methods That Are None Of Your Business So Butt Out"
Thanks for your teaching and for this project, Jeff!
"Nothing to fear but fear itself: introducing recursion in lower secondary schools"
I prepped for all of my interviews by just reviewing these notes, and it seemed to work really well.
Other theory instructors at Illinois do put limits on their IDK policy, like "at most 10% of the total points", or "for at most one question", or "not in my class". So far I've stuck to my guns.
That's kind of a bummer. I like to be able to check my answers when teaching myself things.
Am I somehow alone in that?
I'm honestly seriously torn about this. There is a serious tension between pedagogical needs of students in formal classrooms and the pedagogical needs of self-learners. I've chosen to aim for the former. Yes, I know it's a bummer.
(From experience) providing solutions interferes with the learning process of my own students at Illinois. I have to change up homeworks and exam questions every semester, because otherwise students will look up and copy/memorize the answers instead of trying to figuring them out, which means they do worse on the exams where they HAVE to figure things out.
Also, a significant majority of the requests I get for solutions are from university students who want to cheat.
I do provide solutions to the homework and exam and lab problems I assign in any particular class, after the fact. (And I release those solutions publicly, despite the protests of colleagues at other universities, until the semester ends.) And I have started proving model solutions in the homeworks, so that the students know what kind of answers I'm looking for. (See the course materials page, under CS 374.)
In practice, my stance is becoming increasingly moot, as more of my official solutions get uploaded to places like CourseHero and Koofers and their many foreign-language equivalents.
I am very likely to include solutions for a subset of problems (maybe three or four per chapter) in a future edition. But that will take a significant amount of time, and I wanted to get something out the door.
Makes perfect sense when put this way.
I also really appreciate the response from the author. I forget the gurus behind books like this often have a presence here on HN.
I've found that whether or not a professor releases solutions to assignments (or even tests), some segment of the student population will have access to the solutions. Releasing them publicly ensures the access is universal, instead of limited to those with the right connections/access.
I wonder if a better solution is to provide a set of questions and answers for the book but not use the book questions as the graded homework/exam material.
The one has to be dynamic for the reasons you listed. The other doesn't, and any professor that tries to use your book without creating their own questions will quickly find themselves in the same boat you were, regarding memorization vs internalization.
On the otherhand many classes are graded competitively, so there is enormous pressure to do well on homeworks while you know others have no scruples about being dishonest.
I usually look at the solutions when I've come to the conclusion that the problem is just too difficult and typically discover I hadn't thought of something that made the problem accessible. I would argue that if there are sufficient examples within the chapters, not providing solutions to the exercises shouldn't be a problem.
That is unless you have multi-month/research level problems à la Knuth.
While I understand the desire of a professor to help out their own students, at what point does this become a matter of individual responsibility? Shouldn’t it be the student who refrains from memorizing answers?
When I took my algorithms course, we had a reference textbook with questions at the end of the chapter, but no solutions. Some people at the beginning of the semester tried to crowdsource the answers using a Google doc but that effort failed. It didn’t really matter though, since our homework and exam questions were always renewed each semester through the work of course staff and the instructing professor. In hindsight, I may have taken this for granted as it seems other schools don’t have a “training” and a “testing” set of problems - I would say having both is better than only having one.
Dangling a juicy piece of bacon in front of their noses will not help them eat their vegetables.
Maybe having a separate set of problems for the online version, with solutions, would be appropriate?
I have been wondering this for all freely available textbooks: have you ever thought about turning your book into an open source project? I see you already manage issues on GitHub, but how about managing the actual content there as well?
Producing a printed book might need tighter editing than shipping software, but I feel like there are a lot of books with partially overlapping content, and I feel like self-learners would be better served by larger books that are not meant to be read end-to-end, but that are "integrated" into a larger whole.
But I'm hesitant to release the LaTeX source files in their current (rather grungy) form. Too much of a control freak, I guess. Maybe for the next edition.
Also, the figures are all in a closed file format (OmniGraffle). In principle, I could convert everything to an open-source format like svg, but (0) converting everything would be hell, (1) LaTeX doesn't understand svg files directly, (2) in principle, I can connect latex to inkscape to convert svg to pdf, but the translation is always imprfect, (3) using Inkscape makes me want to tear my hair out, and (4) I'm a control freak.
And don't even talk to me about tikz.
Your proposed solution (include solutions for a few problems) is definitely a good approach: enough to help the self-learners along while forcing the students to work—I assume you’ll be assigning the unsolved problems in class :)
from what i see elsewhere in this thread, you've got quite a good reputation around illinois. i recently lost a favorite professor of my own mid-semester last year, and it made me realize just how much a good instructor means to people. so thank you for being that for students!
Make the unit tests public. Or useable interactively online.
I know it'd be a lot more work. If you had a repo for unit tests, I'd contribute.
Wait, did I say that aloud? Sorry, I meant "I'm already busy enough, thanks."
What happens much more frequently, is that I get stuck somewhere, and get tempted to look at a solution if one is provided, which in turn nullifies the achievement. In this sense, not having solutions, makes it easier for me to plough through.
Solutions are the way I learn the thought process of author if he arrived at the final answer in a better way. Solutions expose errors in questions. Errors and typos in Indian texts were way more a common place in questions than in solutions. There was simply not a chance for a solution to have typo or logical errors.
If there are no solutions, I'd simply put it for later until I am proficient in the subject and want to try out the problems with confidence. There is always this insecurity when it comes to dealing with logic. Little things can slip in abstract thinking pretty easily. Silly mistakes take a toll. People like myself prefer to solve problems individually at our own pace. Solutions are a must for me. Of course, that 'later' almost always never comes.
I spend upto ~1 hour on each problem. And then I google keywords from the questions. Someone somewhere has one possible solution. Usually , this is enough to set me on the right track.
I agree, although looking at the exercises in this book, they seem to be of the form where the only way to give you the answer is you give you the full solution, and they appear to be phrased in a way that makes it easy enough to verify the answer yourself once you’ve figured out the problem. I always feel like the ideal (for me at least) are problems with numerical answers listed in the back of the book – then I can check my answer with the book’s answer; if I got 42 but they got 5, I know I made a mistake somewhere but it’s still up to me to go back through and figure out where the mistake was. It seems like most of these problems don’t lend themselves to short numerical answers like that.
a 5 minute search gave me this - https://github.com/floyernick/Data-Structures-and-Algorithms for algos implemented in Go. github is littered with these kindsa samples(some of them highly vetted) https://github.com/topics/algorithms-and-data-structures
As a sibling comment mentions, it's relatively easy to verify your answer for correctness in some cases. The downside of this is that it becomes difficult to assess whether students are actually learning. One way to mitigate this is to withhold answers and assist with other teaching resources like TAs. This also helps teach the aforementioned 'verification' step.
I remember tracing the lines with my finger as a kid, trying to decipher a hidden logic...
In fact, the logo contains text both in black and navy blue, the navy blue part is "Al-Khawarizmi" or in Arabic "الخوارزمي". Then the navy blue script is rotated at 90 degrees 3 additional times.
https://www.google.com/search?q=arabic+calligraphy+kufi&clie...
Al-Gore-Ithm
Most algorithms books are dry, or they're obsessed by particular formal details, or (worse) they implicitly include optimizations in the algorithm without explaining what is needed for correctness and what is needed for efficiency. Having tutored on one of the books mentioned in the prologue, it can be a real struggle to gain a true intuition for algorithms when you can't yet tell the difference. But the sheer personality contained within this book is infectious, and it really is something of a page-turner. (Lest you think I haven't gotten to the stuff that "matters", I have read through the chapter on depth-first search -- again, an enjoyable read!)
What a great book. I'm definitely recommending this to my friends.
The chapter problems look fantastic, too, and are just as well-written (and they cover a lot of ground).
It's really something!
If so, why is he the exception and why aren’t more PhD programs looking for non-traditional talent?
Edit: I read his blog post. It gave me more insight. It looks possible for people with those sort of grades to be admitted even today, but they seem to need a cheerleader on the inside that will help them.
Sold my house, got rid of all my stuff and enrolled in pure math bachelor's. Best decision of my life.
I though that in my mid 30s with a lot more discipline, being able to work longer and harder would've made up for the shit grades. I'm extremely thankful to the department head for waving me off like that because it would've been a disaster.
Clearly Jeff could handle himself, however I think one must really know what they're doing. I thought I'd end up doing the 3-year math program in 2... it'll turn out to be 3.5 with good grades this time around. After that I know I'll be very solid for master/phd programs.
Can you expand on this? I'm similar right now. Want to go back and get my masters. Graduated in CS about 12 years ago. Mid 30's. What do you mean about having to do another bachelor? I have not heard this before.
> Sold my house, got rid of all my stuff and enrolled in pure math bachelor's. Best decision of my life.
I recently just bought a condo downtown. One because I never plan to move again and rent goes up at least 3-5%/year and two because I can easily rent it out if I do end up leaving. The University of Minnesota is only a mile away from me at the moment. Mortgage is probably a little high for a grad student/TA salary considering I'm making well in to the 6 digits right now. This is my only debt and all my stuff is not much. Mostly things I can't really sell for much now or are required to work and live (computer, desk, monitor, clothes, eat, sleep). I have a couch and a TV to relax outside of work.
Now I presume if you did 2-3 semester with a B+/A- GPA, they would take that as testifying you can handle the masters and let you in, however I'm enjoying math way too much right now and there are several classes (Algebra 1-3, Topology, Differential Equations and several classes in statistics I intend to pick in the option block) that will come in handy if I head into ML masters I'm also interested in Type Theory and all of Discrete Mathematics. Also, I feel math is a great program to improve at general problem-solving.
The first semester was really challenging, some classes I had in fact already done (Calculus 1 and Linear Algebra) turned out to be surprisingly difficult. I'd say around halfway through the second semester I felt I had gotten my younger brain back.
I don't have expensive habits, have two restaurants meal a week, own a car and live at the university residences (rent is 390$/month, parking 850/year). My cost of life seems to be around 12k CAD/year and am Canadian (tuition costs are 1600/semester) so I really have no idea how much you'd have to have saved up if you are in the USA.
Check out: https://ccaps.umn.edu/non-degreeguest-students
See if other schools of interest have similar programs if that one isn't a good fit.
See if you can take courses for credit/get research experience. Then apply for your desired graduate programs.
This is a good way to get letters of recommendations from professors too.
Do you feel TAOCP is worth the time investment or should I just forget about it and tackle something like your book and spend the rest of my time on other topics?
>GRE scores, while collected at admission, were not used or consulted for admissions decisions and comprise the full range of percentiles from 1% to 91%. We report on the 29 students recruited to the Vanderbilt IMSD from 2007-2011 who have completed the program as of summer 2017. While the data set is not large, the predictive trends between GRE and long-term graduate outcomes (publications, first author publications, time to degree, predoctoral fellowship awards, and faculty evaluations) are remarkably null and there is sufficient precision to rule out even mild relationships between GRE and these outcomes. Career outcomes are encouraging; many students are in postdocs, and the rest are in stage-appropriate career environments for such a cohort, including tenure track faculty, biotech and entrepreneurship careers.
Now a GRE isn't a GPA (one's a specific test, one is your grades' average), but both are being used for university admissions, and I reckon both are not good predictors.
Edit: Link: https://www.biorxiv.org/content/early/2018/07/20/373225
Admissions committees are looking for evidence of future success. Admitting applicants with spotty (not merely "nontraditional") backgrounds is risky -- they might be a diamond in the rough, or they might really be a weak student. And (at least departments like mine) there are far too many applicants with stellar backgrounds to justify taking that risk.
At least, that's the usual argument.
- Related, getting authorship (first or otherwise) for an academic publication as an undergraduate is a promising signal of future research success.
- Also related, having great references from undergrad professors who are involved in research.
- Connect with faculty in the PhD program you're interested in.
Context: Got bad grades in undergrad courses related to my particular specialty (digital audio signal processing), but also did all of these, and was admitted to a top PhD program in my field.
Also, a lot of people in my program had success with this one:
- Applying for a masters in a related field or at a department that also has a PhD program that you're interested in, and having success there.
PS: oh and of course all those 'It’s quite easy to show that the...' and similar 'by this point it should be obvious'. No, it is not... I guess I will never understand or use those algorithms even though I'd like to.
But please don't confuse "straightforward" with "obvious". Sometimes I deliberately gloss over mechanical details because I think they're a distraction from the main point. I'm NOT claiming that you should immediately know how to fill in the details; I'm claiming that filling in the details is boring.
If it's obvious to the reader, they know it whether or not you tell them it's obvious. If it's not obvious to them, then they will try to figure it out. Telling this person "it's obvious" only serves to make them feel bad about not getting it right away.
the proof is easy and left as an exercise
The main takeaway I got from Polya's How to Solve it is that properly conceptualizing the problem in your head before attempting to solve it is key.
> ∆ Orange stars indicate that you are eating Lucky Charms that were manufactured before 1998. Ew.
(p. vi)
:)
Really like the book already. The preface falls under the category of advice on learning to learn. Thanks for all your work. #stealthisbook
Coming from a class where we used a decidedly poor textbook for algorithms, this looks like a joy to read.
> Download this book at http://jeffe.cs.illinois.edu/teaching/algorithms/ or http://algorithms.wtf
algorithms.wtf is a beautiful url!
It doesn't feel formal like a textbook and yet doesn't sacrifice on the mathematical rigor. I would be trying out the exercise problems which seem equally daunting but fun.
I also submitted an issue request on Github and Jeff I have a few questions for you that I put on Quora, I have A2A'd you.
Lastly, thanks for taking the time out and putting content like this out for free. It helps millions of autodidacts like me.
The book form of these lectures was in EARLY rough draft when I took the class though-we were proofing chapters for him!
[1]: http://jeffe.cs.illinois.edu/teaching/comptop/2009/schedule....
I love this.
All the fonts are baked into the PDF, so it should be readable anywhere; if it isn't, please submit a bug report!
But if you're looking for a format that lets you reflow the text, by changing the margins or font or text size, you're out of luck. The only way to write something like that is to bake it in from the beginning. That's easy for pure text, but hard to impossible for technical documents with lots of displayed equations, big hard-formatted boxes of text (ie, algorithms), and the like.
(Boaz Barak managed it by writing his Modern Complexity Theory book entirely in Markdown. The mind boggles.)
I'm not sure what makes it hard to reflow. The text seems to be mostly paragraphs with figures, inline formulas and footnotes; pretty basic stuff, no?
(O'Reilly's books were famously typeset with Troff/Groff for many years, though I don't know how painful that was or how advanced their typesetting needs were.)
All I know is that I'd love a version that worked on smaller devices. I tried the Kindle version reformatted by archive.org, but it has lost most of the formatting, making it almost completely unreadable.
I'd especially like an HTML version of the book that was fully hyperlinked, with zoomable vector figures, footnotes hidden away in popups, etc.
I beleive that O'Reilly Media has used ASCIIDoc[0] as their preferred internal format for quite a few years. Formulas are supported through ASCIIMthML[1].
More recently, they seem to have transitioned to HTMLBook[2] as a preferred source format for systems like Atlas[3].
[0] ASCIIDoc is basically a Markdown-like (or ReStructuredText-like) format that is feature-equivalent to DocBook XML: http://asciidoc.org/
[1] http://asciidoc.org/asciimathml.html
The quality of the EPUB is terrible, it looks like it was OCR'd from images of the pages, not just converted from PDF.
Can you make the source format for the book available?
Bravo, Jeff!
WinnerWithPerfectPlay(state,currentPlayer):
if Winner(state)
return Winner(state)
else
nextPlayer <- "white" if currentPlayer = "black" else "black"
return WinnerWithPerfectPlay(PerfectPlay(state, player), nextPlayer)
Which doesn't allow for stalemate moves.For example, bloom filters were rarely taught maybe 10 years ago but probabilistic data structures are now pretty mandatory in a data structure course.
Just wondering if there are sections in this book covering cutting edge stuff for people already familiar with traditional algo
Teaching that material correctly (without the traditional magical thinking) requires serious comfort with probability, which unfortunately isn't early enough in the CS curriculum at Illinois to be used in our data structures and algorithms courses.
Would love to learn more about practical dynamic programming these days, hope there is a book about that extensively.
Algorithms are just ways of solving technical problems in the most efficient way possible (for various definitions of efficiency). They are deep programming which even most programmers don't use frequently.
As others have said, the copyright notice is only a courtesy/reminder. I've held the copyright on all this stuff from the moment I started writing it (and distributing it) 20 years ago.
As soon as you write something, you have the copyright to what you wrote. If it was challenged in court, he would likely easily be able to show his drafts from prior to 12/29/2018 to prove he was the author.
LOTS of people struggle with dynamic programming. But in my experience, 90% of the difficulty with dynamic programming is actually discomfort with recursion, which is why I talk about recursive backtracking first.
Try reading Chapter 2. My goal in that chapter is to show the process of deriving recursive solutions---how to think about the problem, and what questions to ask---rather than just presenting the solution as a fait accompli.
I do have to assume that you believe in the Recursion Fairy, though. That's probably the hardest step. Computer scientists are TERRIBLE at delegating.
I mentioned this elsewhere but figured I'd bring it up here since you're the author.
I've tried explaining recursion in a lot of ways like this, such as "just assume it will work", "trust yourself", and "turn off your brain". (The first two are paraphrases from Matthew Flatt, the latter is from Will Byrd.)
I think "Recursion Fairy" is my favorite way to phrase the same idea. I think there's something about the nature of invoking a sense of magic in the phrasing that might help people really believe that it's okay to just let the recursion do its thing and not think about it too much. I'll definitely be using "Recursion Fairy" when (if) I end up explaining recursion again.
Thanks for making your material available for free! Cheers!
I think a strong foundation in recognizing the recurrence is key to becoming better at Dynamic Programming. If you're not able to first see the recurrence, then you're doomed to rote-learn a la videos on youtube where the main focus is table filling (I'm looking at you, Tushar Roy). Here's a snippet from the DP chapter in Erickson's book:
> In a nutshell, dynamic programming is recursion without repetition. Dynamic programming algorithms store the solutions of intermediate subproblems, often but not always in some kind of array or table. Many algorithms students (and instructors, and textbooks) make the mistake of focusing on the table— because tables are easy and familiar—instead of the much more important (and difficult) task of finding a correct recurrence. As long as we memoize the correct recurrence, an explicit table isn’t really necessary, but if the recurrence is incorrect, we are well and truly hosed.
On a quick skim of the chapter, here's what it offers that other traditional book chapters don't:
* Progressive optimization of memoized solutions. The example used is Fibonacci where each recurrence is cached, then it's transformed into an iterative for-loop based solution where a table/array is filled, and finally 2 variables are used instead of the whole array to store intermediate solutions.
* Dynamic Programming on trees (both as a datastructure for storing intermediate solutions and sometimes as a problem ex: Optimal BST construction)
The main thing is to write down a formulation for the answer for n in terms of answers for smaller n, or the answer for (n, k) in terms of answers for smaller (n, k). (And don't worry about how you'd compute them, just focus on getting a correct expression in terms of smaller ones. http://okasaki.blogspot.com/2008/10/score-one-for-induction....)
It can be tricky to formulate exactly what you're counting / measuring (e.g. what's "k" and what's the quantity you're optimizing for (n, k)), but once you have that, and once you have the recurrence, you can consider it a separate (and independent) step to figure out in which order to compute the values, so that you have each value by the time you need it (i.e. the bottom-up formulation that you said is the tricky part for you).
Beyond that I guess lots of practice with problems… e.g. about a decade ago there used to be weekly(?) TopCoder contests with editorials written later explaining the solutions (and the problems were graded by difficulty and even how many people solved it), and the DPs could get quite tricky. I believe those are still happening, and now there are other resources like LeetCode or whatnot.
Do you have an example of a problem that you struggled with, to see what's missing?
Really? Sure, if the graph is a dag, but then Dijkstra is overkill.
Hmm. I'll have to think about this one.
+1 for the Okasaki shoutout.
But my main point was: if one can look at the shortest-path problem and formulate something like
distance(v) = min_{u->v} (distance(u) + edge_length(u, v))
then one probably has a handle on whatever it is that's hard about dynamic programming. Actually Wikipedia cites some references that consider Dijkstra's algorithm a case of DP: https://en.wikipedia.org/w/index.php?title=Dijkstra%27s_algo... and the same text (Wikipedia doesn't care about “self-plagiarism”) is also on the DP page where Dijkstra's algorithm is given as the first example: https://en.wikipedia.org/w/index.php?title=Dynamic_programmi...
https://www.rand.org/content/dam/rand/pubs/reports/2006/R441...
Did you interview in the past two years at the so-called FAANG companies? 'Leetcoding' has raised the bar considerably, even (or especially, in some cases) for senior positions.