Algorithms, by Jeff Erickson
jeffe.cs.illinois.edu
jeffe.cs.illinois.edu
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.
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.)
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.
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.
I could be wrong, but my intuition goes the other way and I'm assuming most students do it to get a better grade, not learn more.
No, that's what the "albeit selectively" clause was referring to.
>I could be wrong, but my intuition goes the other way and I'm assuming most students do it to get a better grade, not learn more.
As in my comment, it doesn't matter. Their job is to be an expert on this material. Failing to correctly label an answer is failing at their job. Punishing someone for pointing out a failure at your job is unprofessional.
It is the professor's responsibility to grade accurately, and honestly if there is so much inconsistency in grading that there's a significant probability that the student will lose marks despite having pointed out a reason they should gain marks, the professor is screwing up very badly[1]. Don't pin that on the student not having noble intentions or whatever.
[1]:Or at least that's the case in STEM. My humanities friends tell me that grading is much more subjective there which is a bit disturbing but I'm hardly qualified to make such judgments.
It reminds me of those "drunk driving costs you $15k" ads, where most of that comes from the expense of navigating the court system (bail, attorney's fees), and the state is somehow proud of this fact.
Meanwhile, in a less politically charged situation, it's pretty normal, or at least smart, to go back over any area where you messed up with a fine-toothed comb.
If, and this is a rather pessimistic assumption, if the student is likely to lower their grade on a re-test, in my experience it's more likely to be because the original grader was being generous in the face of ambiguity, rather than systemic random errors. That's because the graders are mostly nice people. If that's not good enough for someone, they damn well better have a good reason for it. I have no problem with policy that enforces this. The politics are a distraction from the ethical question.
That's not the same thing as the original, which implied "my grading is so random, hope you're lucky on the rescore".
Edit: I had a high school teacher with a policy where she’d add X points to every score from the get go, and you’dlose those if you objected to grading, so you’d only object for misgrades by more than X. But that’s not the same as the original “okay, let’s roll my truth-recognizer dice again!”
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...Well, from the math profs I've seen, the usual method is to interpose “it is intuitively obvious” in place of the skipped step(s).
The tricky part is having a correct intuition as to what you should be skipping to, sure, but that's the same problem as you have doing a proof (minus actually figuring out the justification) since humans don't generally do proofs by exhaustively listing every possible next step from what is already proven in a BFS until getting the desired result and then pruning all the other paths.
Given A, prove Z
You'd append Assume G => H
...to the prompt, then you'd prove A=>G, and you'd prove H=>Z.You're essentially just using one-too-many axioms to get the job done, which is less elegant, but correct.
It's been about 25 years, so my memory is a bit fuzzy, but it was an analysis class. I don't remember if I ever availed myself of this. I did have a classmate who completed, but didn't turn in his homework a couple of times. (I don't recall if it was the entire problem set or just a couple of problems that he omitted, but he got the paper out to consult while the prof was going over the answers.)
The teacher was competent but quirky - he also required the students to purchase a stapler (to staple their homework) and locked the door after class started (if you were late, tough luck).
Sounds sensible to me.
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.
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"
But the supporting tool is actually in Italian:
Enjoy!
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?
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.
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.
Textbook solutions are good for those that aren’t in school, aren’t in formal programs and have no other way of receiving feedback.
The “you should know if you’re right” mentality doesn’t necessarily fit a person that’s been working for 10-years and has been out of the academic mindset. One that is a beginner and could easily fool themselves into thinking they have a correct answer.
It doesn’t allow for correction of false thinking. Anyone can think their proof is correct. But fewer beginners can properly recognize when they are wrong.
This sort of mentality is a bit elitist and gate keeping.
In the end, he was like "Oh my bad," and corrected his mistake. The point of the story is that they were able to essentially ask him for the solution and they were able to check what they'd done, and in the end he made the mistake. In situations like this, he should provide the answer if nothing else to show that he didn't make a mistake in the problem set. People are fallible, no matter how brilliant you are.
In retrospect I think it was a great lesson for my future career as a data engineer. Doesn’t matter what the source is, any datum can be just plain wrong.
As in, it escaped the gravitational field?
I had a industrial engineering teacher that did something similar. Every team had a (fake money) budget for each project and bought materials from him (sole source). He'd randomly cut corners, to keep everyone on their toes. Good lesson for the real world.
Even if you do have a similar proof to the one in the answer key, that doesn't mean your proof is correct. Correctness can often hinge on very subtle distinctions. You really need a TA or instructor to read your proof if you want meaningful feedback.
One of my colleagues suggested setting up a "club" on PerusAll (https://app.perusall.com/welcome) or something similar that would allow people to discuss to book and/or work through problems collectively. (They have a club for CLRS, for example.) Right now all their "clubs" are restricted to books with Reputable Publishers (ptui), so they might need some persuasion.
As long as cheats are only available for ungraded homework/self assessement tests cheaters are only going to cheat themselves.
Without solutions at the back of the book, self-directed learners can't verify their own work. Don't cut out the less privileged learners from bettering themselves just because you have no concept of discipline.
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
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.
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'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.
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.
[1] https://scholarlycommons.pacific.edu/soecs-facpres/16/ [2] https://www.tandfonline.com/doi/full/10.1080/00091383.2011.5...
Wait, did I say that aloud? Sorry, I meant "I'm already busy enough, thanks."
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.
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.
Though I think the benefit would be less about just releasing the source, though the Open Data Structures book makes a compelling case for that, but fostering collaboration on the content. The books you mention have overlapping content and my heart really wants to join them in some glorious whole :)
Maybe that's crazy, the books clearly have different styles, but I feel like writing more advanced texts as extensions to an evolving intro book would be better for self-learners than just having the books stand alone.
FYI, the link to your course materials on http://opendatastructures.org/ seems to be broken now.
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 :)
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.
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.
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.
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!
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.
Al-Gore-Ithm
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...
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.
>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
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.
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.
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.
My mortgage is far north of $390, haha. I don't have or need a car though. I lease out my parking spot for $150/month or more. If I go and get accepted I'll have either work pay or try and see about scholarship or something. My brother and best friend got free rides through their master and Phd.
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?
But then I've never been able to learn anything by just reading. I always have to have a target problem in front of me, and then I'll read (and get frustrated by) every book ever written to figure out the best way to think about that problem. (Which means I've read a few dozen pages from hundreds of books, and I have pretty huge gaps in my math background -- abstract algebra and category theory being two big examples.)
For some target problems, TOACP has been incredibly helpful, but for most of them it really hasn't. Knuth and I just care about different things.
For the same reason, I can't recommend that anyone work through EVERY problem in my book, either. Find the parts that are interesting and/or useful to you, and work on those. If you get tired or frustrated, work on something else; maybe you'll discover another reason to pick up my book again later. Or not.
Climbing the mountain is much more rewarding than studying the trail map.
IMO one can think of each chapter (only 6 completed so far) or even each major section of TAOCP as a very deep book/monograph on that specialized topic. The writing is clear and delightful (IMO), but each of them does tend to go rather deep, more than you may care to know about that topic — so each page will require a fair bit of attention; it's not easy going. You'll get an in-depth understanding of a narrow sliver of topics.
Why not read a few of the newer sections and see if you'd like to read more in the same style? Knuth has been putting draft versions online, and they are collected here: http://www.cs.utsa.edu/~wagner/knuth/ — for example, you could read Pre-Fascicle 3B, which is on generating all [number-theoretic, or set] partitions, or Pre-Fascicle 1B, which is on a fascinating (and little-known) data structure called Binary Decision Diagrams. He uses these to solve many interesting problems, different from the focus of typical algorithms books (which would probably dismiss these methods as “brute-force”, as they don't affect the asymptotic complexity but do affect what's practical to do on real computers).
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.
- Own your past mistakes. They happened. Don't pretend they didn't. Figure out the underlying cause of those mistakes, and gather EVIDENCE that you've resolved that cause.
(In my case, I was a LAZY undergrad. I'd never had to work in high school, and so I didn't know how to work in college. And then I got a real job, and it was either do the damn work or it'll be there tomorrow only the boss will be there in my office wondering why the hell I'm costing the company hundreds of thousands of dollars a day and why can't you just get this shit DONE already. And so when I applied for grad school the second time I had "smart but lazy" letters from my old professors, stellar GRE scores, and "smart and works hard" letters from my managers.)
- APPLY WIDELY. You are at a significant disadvantage compared to other students with stronger backgrounds. Do not imagine that your passion and good intentions and maturity are enough to get you into the top programs, or even into any particular program. You're playing a lottery that's stacked against you; buy more tickets.
> You're playing a lottery that's stacked against you; buy more tickets.
I take this to mean that is makes more sense to apply for many things, re-submit publications often (not without considering the feedback of reviewers, obviously), and so on.
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.
An example: http://jeffe.cs.illinois.edu/teaching/algorithms/book/Algori... Page 15
> It’s quite easy to show that the singing time is Θ(n2); in particular,the singer mentions the name of a gift ∑ni=1i=n(n+1)/2times (counting thepartridge in the pear tree).
I'm pretty sure that I still remember how to read the formula and I even know what does Θ(n2) means, but it's still unclear for me how do we get n^2 and this formula from the "NDaysOfChristmas(gifts[2..n]):" example.
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 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.
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.
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.
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)
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!