Errata in Fundamentals of Python: Data Structures

(ISBN-13: 978-1-285-75200-6)


Below are the errors that have been discovered in the first printing.  Please report any new errors to


I am grateful to Derrf Seitz for reporting these errors!


Page 20

First line of code after the first full paragraph, "((r, g, b), hexString) = rgbTuple" should be "((r, g, b), hexString) = colorTuple"

Page 22

Last paragraph, "lower+ 1 and upper" should be "lower + 1 through upper"

Page 24

In code for both factorial functions, "n == 1" should be "n == 0"

Page 59

Last line of paragraph before exercise, “the same rate” should be “a linear rate”

Page 69

Caption of Figure 3.10, “bubble sort” should be “insertion sort”

Page 70

Second line from bottom of page, “n/2” should be “(n + 1)/2”

Page 73

Item #3 near the top of the page, “first item in the sublist” should be “first item in the sublist after the boundary”

Page 73

Paragraph above Table 3.11, “Steps 3-6” should be “Steps 3-12” and “in Step 7” should be “in Step 13”

Page 73

The first column of Table 3.11 should contain numbers 1 through 13, starting with the second row (row 1, column 1 remains empty).

Page 114

Figure 4.10, last row, box labeled “probe” should have a diagonal line (backslash) through it

Page 119

Figure 4.14, row 1 of the diagram, “ != None” should be “ != None”

Page 119

Figure 4.14, row 3 of the diagram, “ == None” should be “ = None”

Page 146

First line of code at top of page, “up by one position” should be “left by one position”

Page 173

Table 7.1, row 5 below header, column 1, “c._contains” should be “s._contains”

Page 173

Table 7.1, row 6 below header, column 1, “s_add” should be “s._add”

Page 183

Table 7.7, last row, column 3, “4 5 6 * + 3 - *” should be “4 5 + 6 3 - *”

Page 214

Table 8.2, first row below header, “Q = <Queue” should be “q = <Queue”

Page 226

Last line of output near top of page should be moved back to the end of the previous line, and “Waiting” should be “waiting”

Page 250

Table 9.2, three instances of “i <= len(L)” should be “i < len(L)”

Page 254

Table 9.6, delete row beginning with “hasNext        Undefined”

Page 255

Second line of code near bottom of page, “range(9)” should be “range(1, 10)”

Page 255

Second line of code from bottom of page, “range(2)” should be “range(3)”

Page 256

Fifth line of code from top of page, “range(3)” should be “range(2)”

Page 259

Third paragraph, “list 3, blocks of size 9” should be “list 3, blocks of size 16”

Page 266

Third line of text in Figure 9.5, “”dummy header code” should be “sentinel node”

Page 271

First full paragraph, “the mutator methods insert and remove” should be “the mutator methods insert, remove, and replace”

Page 271

Fourth bulleted item, “running insert or remove” should be “running insert, replace, or remove”

Page 273

First paragraph, “checks the same two preconditions as” should be “checks two preconditions, in a similar manner to”

Page 275

First line of first paragraph, “listIterator” should be “ArrayListIterator”

Page 279

Table 9.10, darker shading should appear over the terms “getModCount,” “incModCount,” “remove”, “__iter__,” “__getitem__,” “”__contains__,” “clear,” “pop,” “__setitem,” and “insert”

Page 294

Figure 10.9, remove box containing “6” from the top level of the figure

Page 296

Last bullet in first bulleted list, “Operands of higher” should be “Operators of higher”

Page 299

Figure 10.15, remove the arrows from C to B and from G to F

Page 303

In the find() method, middle of the page, "elif item <" should be "elif item <"

Page 320

Table 10.8, remove extra left parenthesis from "(heap.add(item)"

Page 339

In quoted code under “def pop,” delete the line that says “or returns the default value otherwise”

Page 351

Table 11.4, last row, column 2, “the value True” should be “the value DELETED”

Page 368

Figure 12.5, empty disk in second diagram should contain “C”

Page 373

Figure 12.12, line from B to A in diagram on the left should be labeled with “1”

Page 385

Second bullet, “or a positive number (for a vertex without a direct edge” should be “or a positive number (for a vertex with a direct edge”

Page 391

Last two lines of output in the middle of the page, “A>:3” should be “A>B:3” and “A>:2” should be “A>C:2”

Page 394

Move “"""Adds a vertex with the given label to the graph." ""” from the first code segment to the line following “def addVertex” in the second code segment

Page 400

Code segment at the top of the page, lines labeled “5” and “6” should be exchanged, so they read “5   Minimum spanning tree” and “6   Topological sort”