Giter Club home page Giter Club logo

algorithms's Introduction

Algorithms by Jeff Erickson

1st paperback edition — June 13, 2019 — Now available from Amazon

This is a bug-reporting site for my Algorithms textbook and other related course materials. Thanks for visiting!

Thanks to everyone who reported bugs in the 0th and ½th editions!

To report an error, please post an issue.

  • Before submitting, please check that your error hasn't already been fixed in the most recent revision.
  • For an error in the book, please include the chapter, section, and page numbers.
  • For an error in the non-book lecture notes, please include the title and the complete URL of the note in question. (There are lots of old revisions floating around the web, with inconsistent titling and numbering, so just the title or the file name may not be enough.)
  • For an error in this semester's homework, labs, exams, or solutions, please post on the course's Piazza site for extra credit, not here.
  • For an error in a past semester's homework, labs, exams, or solutions, please post here, but again with the complete URL of the work in question.

Please also feel free to submit feature requests and other feedback.

While you're here, please feel free to download a complete copy of the most recent revision of the entire book or any of the individual chapters. (The individual chapters are extracted from the book pdf file to keep page numbers consistent; unfortunately, hyperlinks don’t work.)

A black and white electronic version of the entire manuscript is also available, which should more closely reflect the appearance of the printed volume. I won’t update that quite as often.


Publication History

The most up-to-date version of the book and individual chapters is in the top-level directory. Archival snapshots of official releases (“editions” or “printings”) are in corresponding subdirectories. See the Errata for a list of updates since the most recent official release.

  • 0th edition (prepublication draft) — December 29, 2018
  • ½th edition (prepublication draft) — April 9, 2019
  • 1st paperback edition — June 13, 2019 — Amazon links: US, UK, DE, ES, FR, IT, JP

Additional Materials

The book contains only a small subset of my course materials; you can find hundreds more pages of lecture notes, lab handouts, and past homeworks and exams at http://jeffe.cs.illinois.edu/teaching/algorithms, or at the mnemonic shortcut http://algorithms.wtf. You can see the material in context at the web sites for my most recent offerings of CS 374 and CS 473 at Illinois.

At some future date, I am likely to incorporate more (but definitely not all) of these lecture notes into a future edition. (I haven't decided whether I'm going to call it a "director's cut" or an "extended dance remix".) One step at a time.


Copyright

Copyright 2019 Jeff Erickson

Everything on this site is available under a Creative Commons Attribution 4.0 International License. For license details, see http://creativecommons.org/licenses/by/4.0/.

algorithms's People

Contributors

jeffgerickson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

algorithms's Issues

Edit Distance Memo Table Query

Page 113 has the edit distance memo table for ALGORITHM to ALTRUISTIC - the entry for ALGORIT to ALT has a cost of 4 with both a free replacement and a deletion from a cost of 4 - should the deletion arrow be there ? I very much like your notes and have been using them for a couple of years (with attribution) - I recalculated the table and my version is on my slide 108/142 of http://www.pmolyneux.co.uk/OU/M269/M269TutorialNotes/M269TutorialGraphs/M269TutorialGraphs2017J.beamer.pdf - it looks like your notes are produced in LaTeX - I used LaTeX with the PGF/TikZ package to typeset the table (though I used Haskell to calculate the PGF/TikZ for the table)

Quicksort Analysis

I might be mistaken, but I believe that there's an error in the average run-time analysis of the quicksort algorithm on page 30.

Specifically, if we substitute a pivot about the median element (i.e., ⌈n/2⌉) into the first recurrence, we should end up with

T(n) = T(⌈n/2⌉ - 1) + T(⌊n/2⌋) + O(n) <= 2T(n/2) + O(n)

instead of

T(n) = 2T(⌈n/2⌉ - 1) + T(⌊n/2⌋) + O(n) <= 2T(n/2) + O(n).

That is, there appears to be an errant 2 on the left side of the equality statement.

On a related (but minor) note, in the recurrence analysis of the worst case run-time that follows, I believe the parentheses around the max(...) function can be scoped tighter, since O(n) is constant for all values of r.

Typo in Karatsuba footnote

There is a typo in the formula in footnote 10 on page 41. It should be
(a+b)(c+d)-ac-bd = bc+ad
So the first part has b and c swapped.

Typo in chapter 6

Section 12.4
... A Turing machine is a very restrictive type of computer whose precise definition is surprisingly unimportant.

(incredible book by the way !)

Typos in Introduction

Footnote 9, missing period.

I'll add any more if I notice them.

Or anybody else is welcome to comment. Why perhaps do you not open a set of Issues "Typos in " and let people comment?

Top of page 14, " (Slide) " appears to be an extraneous remnant. Or a joke I don't get?

typo -- "with with"

"An edge is safe if it is the minimum-weight edge with with exactly one endpoint in some component of F." in section 7.2 The Only Minimum Spanning Tree Algorithm

Ch. 1 section 3 pg. 25: Tower of Hanoi

In the second paragraph, it says

We can’t move it at the beginning, because all the other disks are in the way. So first we have to move those n−1 disks to the third peg

It's actually, move those n-1 disks to the second peg

All the extra n-1 disks have to be moved to second peg, the largest nth disk has to be moved to the 3rd peg and all n-1 disks have to be moved on top of the nth disk in 3rd peg.

Replace EPUB and KINDLE (MOBI) formats from Internet Archive page

I tested these files using iBooks (EPUB), the Kindle Mac app (MOBI), and Calibre (both); they're complete garbage. Apparently those files were created by extracting OCR'd text from the PDF file, including OCRing text in figures, but completely bollixing graphics and math and tables and everything.

Producing a true reflowable e-book format is preactically impossible, but at least this crap should be removed.

Resolve Acrobat-reported printing issues

To quote Acrobat's report:

Warning:

  • Document images on CMY plates (45 matches on 3 pages): 23, 344, 417
  • Uses device-independent color (3 matches on 2 pages): 23, 344

Info:

  • Resolution of bitmap images is less than 550 ppi (1 match on 1 page): 23 — [Eutocius in Greek]
  • Text is smaller than 5 pt (250 matches on 16 pages): 69, 91, 183, 212, 244, 248, 255, 257, 299, 300, 302, 306, 310, 344, 375, 426 — [mostly sub/superscripts in figure labels]
  • Uses CID Type 0 font (2 matches on 1 page): 228 — [star in number maze]

typo -- "chasing the definitions"

5.7 Graph Reductions, Flood Fill

"The flood-fill problem can be reduced to the reachability problem by chasing
the definitions" -> "The flood-fill problem can be reduced to the reachability problem by changing
the definitions"

Chapter 6, Exercise 3(c) - Possibly wrong question

Please correct me if I am wrong, but I think the lemma asked to be proven in the exercise 3(c) of chapter 6 is incorrect.

Let T be an arbitrary spanning tree of G, rooted at an arbitrary vertex r.
For each vertex v, let Tv denote the subtree of T rooted at v; for example,
Tr = T . Prove that v is a cut vertex of G if and only if G does not have
an edge with exactly one endpoint in Tv .

Consider the below (DFS) spanning tree for example:

kyumejvidyjeovpb

Clearly vertex 1 has an edge with exactly one endpoint in T1, but vertex 1 is a cut vertex.

Definition/Description of Algorithm in 0.1 misses finiteness as a necessary condition.

In sec. 0.1, an algorithm is informally defined, described. It lists a set of conditions for it including unambiguousness, precision, etc. of instructions.

But it does not list finiteness of the sequence of instructions as a necessary condition.

I think this is not consistent with how algorithms are defined and understood in the CS community. They are defined, among other things, to be finite sequences of instructions.

Therefore, I think the list of conditions should be amended to include finiteness as a necessary condition.

Thanks.

Possible recurrence relation error in Subset Sum: Ch. 3 section 8 pg. 114

page 114, section 3.8: In the pseudo code recurrence relation at the bottom of the page for subset sum modified for avoiding the case when t is negative, it says SS(i, t) = SS(i + 1, t) when t > X[i] in the third case, for that case wouldn't it be valid when t < X[i] rather than t > X[i], as that would make the t that is being passed in negative when doing SS(i, t - X[i]) which would automatically yield a False.

Chapter 5, p.22, Exercise 6(a) -- a minor issue.

The following seems like a definition of a Hamiltonian path, rather than a cycle, since in the latter case the starting/terminal vertex gets visited twice.

A Hamiltonian cycle in a graph G is a cycle of edges in G that visits every vertex of G exactly once

typos in preface

pg iv:

the goal of these problems not to solve these particular problems,
but to practice exercising a particular skill

wants to have is between problems and not to.

I'll add more typos to this issue as I find them. Thank you for your book.

Unrelatedly: is there a chance you would share the source files for the book?

Where's the book already?

The book was supposed ot be out over the summer. Where is it? These constant delays are completely unprofessional!

Mātrāvṛtta

This book looks great! Thanks for writing it and making it free. There are some very interesting problems and topics and I hope to work though it some day.

From looking at the table of contents, my attention was drawn to section 3.1 titled Mātrāvṛtta. Firstly, glad to see this. :-) And as I've read a tiny bit about the topic, a couple of corrections: in

one class of meters, variously called mātrāvṛtta or mātrāmeru or matrāchandạ

— here, ("Meru" is the name of a mountain; and “mātrāmeru” is the name of a “mountain” of numbers or metres, somewhat like “Pascal's triangle”, so) mātrāmeru should be removed, as it's not a name of the class of metres. Also, the last word should be mātrāchandas (with an s at the end, and without the dot below the a).

(There's unfortunately not a great reference for these that I'm aware of—what did you use?—though this is one that at least cites the primary sources properly.)

Also, later down the page it says “—“ with two opening quotes instead of an opening/closing quote pair.

Chapter 2, p. 86 - Copy/paste error in pseudocode

In the updated LISBigger pseudocode that uses indices instead of arrays, the else if block is using the same code as the previous version:

...
else if A[1] <= prev
...

when it should be using the new version:

...
else if A[i] >= A[j]
...

as per the piece-wise function definition.

Minor typos in commit fbf5aea (and bc54407)

The following typos exist in fbf5aea and therefore also in the B&W bc54407.

Page 226 of the main book (§6.1): The first sentence of the first paragraph under the pseudocode for Preprocess, PreVisit, and PostVisit reads "This algorithm assigns v.pre (and advance the clock)": "advance" should be "advances". A similar typo exists later in the sentence after v.post.

Page 257 of the main book (§7.2): The last bullet point has a duplicated word "An edge is safe if it is the minimum-weight edge with with exactly one".

(These two typos are right next to typos found in my previous typos issue too! Ugh!)

Missing word in 4.5 Stable Matching, page 170

In Greedy Algorithms, 4.5 Stable Matching, section "Some Bad Ideas", page 170

At the top of the page:

Unfortunately, resolving one instability can new ones

Should probably be "can create new ones" or such.

Karatsuba

In ch1, Anatoly Karatsuba's last name is misspelled several times as "Karastuba."

Kosaraju's algorithm is mistyped as "Koraraju"

In Chapter 6, "Depth-First Search", in the section "Koraraju and Sharir’s Algorithm", Kosaraju's name is misspelt in the title and body text as "Koraraju".

(The footnote on the first page of the section, however, as well as the algorithm pseudocode itself, has the correct spelling for the name.)

Exceptionally minor "repeated word" typos

A professor I had in college was compiling lecture notes into a textbook, and offered $5 for any typo or error discovered in the notes. My friend exploited this by searching for "double words," like "the the," etc. My friend made quite a bit of money that semester.

Along these lines, I've found "the the" in Sections 7.1 (page 256) and 7.5 (page 265), and "of of" in Exercise 7.4b (page 266) and Section 9.3 (page 310). There may be other words which are repeated in this manner, I didn't check them all.

Format for e-readers?

An EPUB (or MOBI, or AZW3) format version of the book would be very much appreciated.

Minor Typos on Pages 26, 29, and 30

The following typos appear in the 0th edition, dated December 29, 2018:

  • In the footnote on page 26, I believe it should read:
    • "...because the EDVAC could sort faster than IBM’s dedicated sorters..."
  • On page 29, I think it should probably read:
    • "In the separate Partition subroutine, the input parameter p is the index of the pivot element..."
  • On page 30, it should probably read:
    • "...and take the median of those three elements as the pivot."

B.2: Possible mistake in trivial analysis of number of maximal independent sets

Near the end of the first section of B.2, we find the following:

Thus, the
number of maximal independent sets satisfies the recurrence M(n) ≤ 2M(n − 1), with
base case M(1) = 1. We can easily guess and confirm the solution M(n) ≤ (2^n) − 1. The
only subset that we aren’t counting with this upper bound is the empty set!

I'm not 100% confident in my understanding here, but if I understand what you're trying to do with the "easily guess and confirm", then that should be parenthesized as 2^(n-1) instead.

Ch. 0 section 3 pg. 9: possible error in Huntington-Hill pseudocode

I understand the pseudocode as follows:

The first for allocates n representatives, and decreases R by n (I'll call this R' = R - n).
The second for runs from n+1 to R', i.e. it allocates R - 2n representatives.

The total number of representatives allocated is then only R - n.

Create index

The printed book needs an index. (The real world doesn't have grep / ctrl-F / a magnifying glass icon.)

Small heart and Large heart look the same

They are similar in shape and colour, and differ only slightly in size, so you need to have them side by side to notice the difference.

A different symbol for the open problems would be appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.