Errata

Ada Plus Data Structures: An Object-Oriented Approach
2nd Edition

Nell Dale and John McCormick

Please report any additional errors you find to: mccormick@cs.uni.edu


Page
 


Correction
 

30

2nd sentence should read:  For example, here is a list of some further scenarios:

99

Figure 2.7.  There should not be any space between the record fields Year and Make

129

Last sentence of the third paragraph.  Change Supercharged to Turbocharged

156

Exercise 15 is missing a semicolon at the end of the declaration of type B_Array.  The declaration of Y is missing a vertical bar in the array aggregate.  It should be (2 | 3 => True, others => False)

158

Exercise 29 should read:  "What is the relationship between primitive operations and inheritance?"

179

EBNF of generic_package_declaration.  The reserved word generic should be bold.

The line {generic_parameter_declaration} should be indented.

182

The reserved words limited and private in the EBNF definition of formal_private_type_definition should be bold.

218

The answer shown for the last example on the page, "Returns 5", is wrong.  The correct answer is "Returns 0".  The Mapping is applied only to the Source string.  In this example the source "Mildred" is mapped to "mildred" which does not contain the pattern "Red".

225

The text states incorrectly that there are no input or output operations in the Ada library for bounded-length strings.  In fact, the package Ada.Text_IO.Bounded_IO provides input and output operations for bounded-length strings.  See section A.10.11 of the Ada language reference manual for details.

228

Procedure Remove_Extra_BLanks should be Remove_Extra_Blanks

237

The first sentence in the second paragraph should read:  "We cannot access data in storage obtained through a new operation by name because they have no declared name."

248

The 4th bullet point under Finalize.  The first sentence should read "when a dynamically allocated controlled object ceases to exist."  In the second sentence, the instance should be of Ada.Unchecked_Deallocation

296

Figure 5.9(b)  The brackets are not correct.  The Stack Elements are those from index (1) to index (2).  The Logical Garbage are the elements from index (3) to index (100)

313

Line 16 of Encapsulation Revisited: change have to change every array references to have to change every array reference (singular)

320

Comparison of Rates of Growth table:   The entry for Nlog2N in the first row should be 0, not 1.

325

Exercise #3a.  The fourth statement should assign 4 to Z, not to X
Z := 4;

336

Exercise #24.  The three local variables are not indented correctly.  They appear to be parameters rather than local variables.

367

The with Unchecked_Deallocation; should be with Ada.Unchecked_Deallocation;

368

In line 2, Unchecked_Deallocation should be prefixed as Ada.Unchecked_Deallocation

In keeping with our style of always using .all to dereference pointers, the first and third lines of procedure Dequeue should read

  Item := Queue.Front.all.Info        -- Get the value from the front node
 
Queue.Front := Queue.Front.all.Next -- Change the front

Enqueue and Dequeue omit checking for and raising OVERFLOW and UNDERFLOW

397

In exercises 23 and 24, bounded queue should be unbounded queue

466

Exercise 9.  Company_String should be a subtype not a type
subtype Company_String is String (1..20);

475

Exercise 35.  Incorrect parameter mode for List in procedure First.  The mode should be in out.
procedure First (List : in out List_Type);

546

Exercise 36d should read "What would the array look like after the deletion of Nell from List1?"
Exercise 36e should read "What would the array look like after the insertion of Tracy into List2?"

615

Exercise 7a and 7b are missing the statement return Result; after the if statement

651

There is a missing + sign in the general case in the first function Size on the page (the incorrect version).  It should read:

return 1 + Size (Tree.Root.all.Left)
         + Size (Tree.Root.all.Right);

666

While procedure Recursive_Insert in this package is correct, the one given on page 654 is more efficient as it requires fewer calls to function Key_Of

690

Exercise 2 should read "Which of these formulas gives the maximum total number of nodes in a tree whose bottom level is N (Remember that the root is Level 0.)"

693

Clarification for exercise 15b.  Changing the shape of a tree requires a change of one or more pointers (external or internal).

694

Exercise 20.  In order to use the iterator, parameter Tree must have in out mode.  Change the function to a procedure

procedure Greatest_Frequency (Tree   : in out Freq_Tree.Tree_Type;
                              Result :    out Natural) is
-- Purpose        : Finds the highest frequency of words in Tree
-- Preconditions  : None
-- Postconditions : If Tree is empty, Result is 0. Otherwise, Result
--                  is the highest frequency count in Tree

703

Exercise 41.  There are two binary trees labeled (a).  The tree with a root whose value is 46 should be labeled (b).

742

The comment for the loop in the breadth first search at the top of the page should read

-- Enqueue all adjacent vertices not yet visited

826

Line 9 from the bottom: change  if Table_Size meets the two criteria, quadratic to  if Table_Size meets the following  two criteria, quadratic

852

Exercise 51d.  The formula for double hashing should be 1 + Key rem (Table Size - 2).

854

Exercise 58.   The formula for double hashing should be 1 + Key rem (Table Size - 2).  The value 448 should be in array location 18 rather than 17.

854

Exercise 62.  There is only room for 10 elements in the hash table so just insert the first 10 elements from exercise 59.