100% found this document useful (1 vote)
17 views

(eBook PDF) Data Structures and Abstractions with Java 4th Edition pdf download

The document provides links to various editions of the eBook 'Data Structures and Abstractions with Java' along with additional Java programming resources. It outlines the structure and pedagogical features of the book, including chapters on abstract data types, algorithm complexity, and programming tips. The book is designed to enhance learning with exercises, video tutorials, and instructor resources available online.

Uploaded by

inselheeya1o
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
17 views

(eBook PDF) Data Structures and Abstractions with Java 4th Edition pdf download

The document provides links to various editions of the eBook 'Data Structures and Abstractions with Java' along with additional Java programming resources. It outlines the structure and pedagogical features of the book, including chapters on abstract data types, algorithm complexity, and programming tips. The book is designed to enhance learning with exercises, video tutorials, and instructor resources available online.

Uploaded by

inselheeya1o
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

(eBook PDF) Data Structures and Abstractions

with Java 4th Edition install download

https://ebookluna.com/product/ebook-pdf-data-structures-and-
abstractions-with-java-4th-edition/

Download more ebook from https://ebookluna.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

(eBook PDF) Data Structures and Abstractions with Java 4th


Global Edition

https://ebookluna.com/product/ebook-pdf-data-structures-and-
abstractions-with-java-4th-global-edition/

ebookluna.com

Data Structures and Abstractions with Java 5th Edition


(eBook PDF)

https://ebookluna.com/product/data-structures-and-abstractions-with-
java-5th-edition-ebook-pdf/

ebookluna.com

(eBook PDF) Data Structures and Abstractions with Java 5th


Edition by Frank M. Carrano

https://ebookluna.com/product/ebook-pdf-data-structures-and-
abstractions-with-java-5th-edition-by-frank-m-carrano/

ebookluna.com

(eBook PDF) Starting Out with Java: From Control


Structures through Data Structures 4th Edition

https://ebookluna.com/product/ebook-pdf-starting-out-with-java-from-
control-structures-through-data-structures-4th-edition/

ebookluna.com
(eBook PDF) Data Structures and Other Objects Using Java
4th Edition

https://ebookluna.com/product/ebook-pdf-data-structures-and-other-
objects-using-java-4th-edition/

ebookluna.com

(eBook PDF) Data Structures and Problem Solving Using Java


4th Edition

https://ebookluna.com/product/ebook-pdf-data-structures-and-problem-
solving-using-java-4th-edition/

ebookluna.com

(eBook PDF) Starting Out with Java: From Control


Structures through Data Structures 3rd Edition

https://ebookluna.com/product/ebook-pdf-starting-out-with-java-from-
control-structures-through-data-structures-3rd-edition/

ebookluna.com

(eBook PDF) Introduction to JAVA Programming and Data


Structures Comprehensive Version 11

https://ebookluna.com/product/ebook-pdf-introduction-to-java-
programming-and-data-structures-comprehensive-version-11/

ebookluna.com

(eBook PDF) Java Foundations: Introduction to Program


Design and Data Structures 5th Edition

https://ebookluna.com/product/ebook-pdf-java-foundations-introduction-
to-program-design-and-data-structures-5th-edition/

ebookluna.com
●● Chapters 10 and 11 use exceptions in the specification and implementations of the ADTs queue, deque,
New to this Edition
and priority queue.
●● Chapter 11 no longer covers the vector-based implementation of the ADT queue; it is left as a program-
ming project.
●● Chapters 12, 13, and 14 use exceptions in the specification and implementations of the ADT list.
●● Chapter 13 changes the array-based implementation of the ADT list by ignoring the array element at
index 0. The vector-based implementation of the ADT list is no longer covered, but is left as a program-
ming project.
●● Chapter 15 covers only iterators for the ADT list. The concepts of an iterator in Java are treated in the
preceding Java Interlude 5 instead of in this chapter.
●● Chapter 20 no longer covers the vector-based implementation of the ADT dictionary; it is left as a
programming project.
●● Chapter 23 defines balanced binary trees, which previously was in Chapter 25.
●● Chapter 24 no longer defines an interface for a binary node, and the class BinaryNode no longer
implements one.

vi
The topics that we cover in this book deal with the various ways of organizing data so that a given

A Note to Students
application can access and manipulate data in an efficient way. These topics are fundamental to your future
study of computer science, as they provide you with the foundation of knowledge required to create com-
plex and reliable software. Whether you are interested in designing video games or software for robotic
controlled surgery, the study of data structures is vital to your success. Even if you do not study all of the
topics in this book now, you are likely to encounter them later. We hope that you will enjoy reading the
book, and that it will serve as a useful reference tool for your future courses.
After looking over this preface, you should read the Introduction. There you will quickly see what this
book is about and what you need to know about Java before you begin. The Prelude discusses class design
and the use of Java interfaces. We use interfaces throughout the book. Appendixes A through E review
javadoc comments, Java basics, classes, inheritance, and files. New Java Interludes occur throughout the
book and cover advanced aspects of Java as they are needed. Note that inside the front and back covers
you will find Java’s reserved words, its primitive data types, the precedence of its operators, and a list of
Unicode characters.
Please be sure to browse the rest of this preface to see the features that will help you in your studies.

vii
Features to Enhance Learning
Pedagogical Elements

Each chapter begins with a table of contents, a list of prerequisite portions of the book that you should
have read, and the learning objectives for the material to be covered. Other pedagogical elements appear
throughout the book, as follows:

Notes Important ideas are presented or summarized in highlighted paragraphs and are meant
to be read in line with the surrounding text.
VideoNote

Security Notes Aspects of safe and secure programming are introduced and h­ ighlighted in
this new feature.
VideoNote

A Problem Solved Large examples are presented in the form of “A Problem Solved,” in which
a problem is posed and its solution is discussed, designed, and implemented.

Design Decisions To give readers insight into the design choices that one could make when
formulating a solution, “Design Decision” elements lay out such options, along with the
VideoNote rationale behind the choice made for a particular example. These discussions are often in the
context of one of the “A Problem Solved” examples.

Examples Numerous examples illuminate new concepts.

Programming Tips Suggestions to improve or facilitate programming are ­presented as soon


as they become relevant.
VideoNote

Self-Test Questions Questions are posed throughout each chapter, integrated within the text,
that reinforce the concept just presented. These “self-test” questions help readers to understand
the material,
VideoNotesince answering them requires pause and reflection. Solutions to these questions

are provided at the end of each chapter.

VideoNotes Online tutorials are a Pearson feature that provides visual and audio support to
the presentation given throughout the book. They offer students another way to recap and
VideoNote reinforce key concepts. VideoNotes allow for self-paced instruction with easy navigation,
including the ability to select, play, rewind, fast-forward, and stop within each video. Unique
VideoNote icons appear throughout this book whenever a video is available for a particular
concept or problem. A detailed list of the VideoNotes for this text and their associated loca-
tions in the book can be found on page xxvi. VideoNotes are free with the purchase of a new
textbook. To purchase access to VideoNotes, please go to
pearsonhighered.com/carrano

Exercises and Programming Projects Further practice is available by solving the exercises
and programming projects at the end of each chapter. Unfortunately, we cannot give readers the
answers to these exercises and programming projects, even if they are not enrolled in a class.
Only instructors who adopt the book can receive selected answers from the publisher. For help
with these exercises and projects, you will have to contact your instructor.
viii
Accessing Instructor and Student Resource Materials

Resources
The following items are available on the publisher’s website at pearsonhighered.com/carrano:

●● Java code as it appears in the book


●● A link to any misprints that have been discovered since the book was published
●● Links to additional online content, which is described next

Instructor Resources
T he following protected material is available to instructors who adopt this book by logging onto Pearson’s
Instructor Resource Center, accessible from pearsonhighered.com/carrano:
●● PowerPoint lecture slides
●● Solutions to exercises and projects
●● Test bank
●● Instructor source code
●● Figures from the book
Additionally, instructors can access the book’s Companion Website for the following online premium
content, also accessible from pearsonhighered.com/carrano:
●● Instructional VideoNotes
●● Appendixes B, C, and E
●● A glossary of terms
Please contact your Pearson sales representative for an instructor access code. Contact information is avail-
able at pearsonhighered.com/replocator.

Student Resources
The following material is available to students by logging onto the Companion Website accessible from
pearsonhighered.com/carrano:

●● Instructional VideoNotes
●● Appendixes B, C, and E
●● A glossary of terms
Students must use the access card located in the front of the book to register for and then enter the Com-
panion Website. Students without an access code can purchase access from the Companion Website by
following the instructions listed there.
Note that the Java Class Library is available at docs.oracle.com/javase/8/docs/api/.

ix
Content Overview
Detailed Content Description

Readers of this book should have completed a programming course, preferably in Java. The appendixes
cover the essentials of Java that we assume readers will know. You can use these appendixes as a review or
as the basis for making the transition to Java from another programming language. The book itself begins
with the Introduction, which sets the stage for the data organizations that we will study.
●● Prelude: At the request of readers of the previous edition, we have moved the introduction to class
design from the appendix to the beginning of the book. Most of the material that was in Appendix D of
the third edition is now in the Prelude, which follows the Introduction.
●● Chapters 1 through 3: We introduce the bag as an abstract data type (ADT). By dividing the mate-
rial across several chapters, we clearly separate the specification, use, and implementation of the bag.
For example, Chapter 1 specifies the bag and provides several examples of its use. This chapter also
introduces the ADT set. Chapter 2 covers implementations that use arrays, while Chapter 3 introduces
chains of linked nodes and uses one in the definition of a class of bags.
In a similar fashion, we separate specification from implementation throughout the book when
we discuss various other ADTs. You can choose to cover the chapters that specify and use the ADTs
and then later cover the chapters that implement them. Or you can cover the chapters as they appear,
implementing each ADT right after studying its specification and use. A list of chapter prerequisites
appears later in this preface to help you plan your path through the book.
Chapter 2 does more than simply implement the ADT bag. It shows how to approach the imple-
mentation of a class by initially focusing on core methods. When defining a class, it is often useful
to implement and test these core methods first and to leave definitions of the other methods for later.
Chapter 2 also introduces the concept of safe and secure programming, and shows how to add this
protection to your code.
●● Java Interludes 1 and 2: The first Java interlude introduces generics, so that we can use it with our
first ADT, the bag. This interlude immediately follows Chapter 1. Java Interlude 2 introduces excep-
tions and follows Chapter 2. We apply this material, which was formerly in an appendix, to the imple-
mentations of the ADT bag.
●● Chapter 4: Here we introduce the complexity of algorithms, a topic that we integrate into future
chapters.
●● Chapters 5 and 6: Chapter 5 discusses stacks, giving examples of their use, and Chapter 6 implements
the stack using an array, a vector, and a chain.
●● Chapter 7: Next, we present recursion as a problem-solving tool and its relationship to stacks.
Recursion, along with algorithm efficiency, is a topic that is revisited throughout the book.
●● Java Interlude 3: This interlude provides the Java concepts needed for the sorting methods that we
are about to present. It introduces the standard interface Comparable, generic methods, bounded type
parameters, and wildcards.
●● Chapters 8 and 9: The next two chapters discuss various sorting techniques and their relative com-
plexities. We consider both iterative and recursive versions of these algorithms.
●● Java Interlude 4: This Java interlude shows how the programmer can write new exception classes. In
doing so, it shows how to extend an existing class of exceptions. It also introduces the finally block.
●● Chapters 10 and 11: Chapter 10 discusses queues, deques, and priority queues, and Chapter 11 con-
siders their implementations. It is in this latter chapter that we introduce circularly linked and doubly
linked chains. Chapter 11 also uses the programmer-defined class EmptyQueueException.
●● Chapters 12, 13, and 14: The next three chapters introduce the ADT list. We discuss this collection
abstractly and then implement it by using an array and a chain of linked nodes.
●● Java Interlude 5 and Chapter 15: The coverage of Java iterators that was formerly in Chapter 15
now appears before the chapter in Java Interlude 5. Included are the standard interfaces Iterator,

x
Iterable, and ListIterator. Chapter 15 then shows ways to implement an iterator for the ADT list.

Detailed Content Description


It considers and implements Java’s iterator interfaces Iterator and ListIterator.
●● Java Interlude 6: This interlude discusses mutable and immutable objects, material that previously
was in the online Chapter 30.
●● Chapters 16 and 17 and Java Interlude 7: Continuing the discussion of a list, Chapter 16 intro-
duces the sorted list, looking at two possible implementations and their efficiencies. Chapter 17 shows
how to use the list as a superclass for the sorted list and discusses the general design of a superclass.
Although inheritance is reviewed in Appendix D, the relevant particulars of inheritance—including
protected access, abstract classes, and abstract methods—are presented in Java Interlude 7 just before
Chapter 17.
●● Chapter 18: We then examine some strategies for searching an array or a chain in the context of a list
or a sorted list. This discussion is a good basis for the sequence of chapters that follows.
●● Java Interlude 8: Before we get to the next chapter, we quickly cover in this interlude situations
where more than one generic data type is necessary.
●● Chapters 19 through 22: Chapter 19 covers the specification and use of the ADT dictionary.
Chapter 20 presents implementations of the dictionary that are linked or that use arrays. Chapter 21
introduces hashing, and Chapter 22 uses hashing as a dictionary implementation.
●● Chapters 23 and 24 and Java Interlude 9: Chapter 23 discusses trees and their possible uses.
Included among the several examples of trees is an introduction to the binary search tree and the heap.
Chapter 24 considers implementations of the binary tree and the general tree. Java Interlude 9 dis-
cusses cloning, a topic that was previously online. We clone an array, a chain of linked nodes, and a
binary node. We also investigate a sorted list of clones. Although this material is important, you can
treat it as optional, as it is not required in the following chapters.
●● Chapters 25 through 27: Chapter 25 focuses on the implementation of the binary search tree.
Chapter 26 shows how to use an array to implement the heap. Chapter 27 introduces balanced search
trees. Included in this chapter are the AVL, 2-3, 2-4, and red-black trees, as well as B-trees.
●● Chapters 28 and 29: Finally, we discuss graphs and look at several applications and two
implementations.
●● Appendixes A through E: The appendixes provide supplemental coverage of Java. As we mentioned
earlier. Appendix A considers programming style and comments. It introduces javadoc comments
and defines the tags that we use in this book. Appendix B reviews Java up to but not including classes.
However, this appendix also covers the Scanner class, enumerations, boxing and unboxing, and
the for-each loop. Appendix C discusses Java classes, Appendix D expands this topic by looking at
composition and inheritance, and Appendix E discusses files.

xi
Acknowledgments
Acknowledgments

Our sincere appreciation and thanks go to the following reviewers for carefully reading the previous edi-
tion and making candid comments and suggestions that greatly improved the work:

Tony Allevato—Virginia Polytechnic Institute and State University


Mary Boelk—Marquette University
Suzanne Buchele—Southwestern University
Kevin Buffardi—Virginia Polytechnic Institute and State University
Jose Cordova—University of Louisiana at Monroe
Greg Gagne—Westminster College
Victoria Hilford—University of Houston
Jim Huggins—Kettering University
Shamim Kahn—Columbus State University
Kathy Liszka—University of Akron
Eli Tilevich—Virginia Polytechnic Institute and State University
Jianhua Yang—Columbus State University
Michelle Zhu—Southern Illinois University
Special thanks go to our support team at Pearson Education Computer Science during the lengthy pro-
cess of revising this book: Executive Editor Tracy Dunkelberger, Program Manager Carole Snyder, P ­ rogram
Management-Team Leader Scott Disanno, and Project Manager Bob Engelhardt have always be a great help
to us in completing our projects. Our long-time copy editor, Rebecca Pepper, ensured that the presentation is
clear, correct, and grammatical. Thank you so much!
Our gratitude for the previously mentioned people does not diminish our appreciation for the help pro-
vided by many others. Steve Armstrong produced the lecture slides for this edition and previous editions of
the book. Professor Charles Hoot of the Oklahoma City University created the lab manual, Professor Kathy
Liszka from the University of Akron created the new collection of test questions, and Jesse Grabowski pro-
vided the solutions to many of the programming projects. Thank you again to the reviewers of the previous
editions of the book:
Reviewers for the third edition:
Steven Andrianoff—St. Bonaventure University
Brent Baas—LeTourneau University
Timothy Henry—New England Institute of Technology
Ken Martin—University of North Florida
Bill Siever—Northwest Missouri State University
Lydia Sinapova—Simpson College
Lubomir Stanchev—Indiana University
Judy Walters—North Central College
Xiaohui Yuan—University of North Texas
Reviewers for the second edition:
Harold Anderson—Marist College
Razvan Andonie—Central Washington University
Tom Blough—Rensselaer Polytechnic Institute
Chris Brooks—University of San Francisco
Adrienne Decker—University at Buffalo, SUNY

xii
Henry Etlinger—Rochester Institute of Technology

Acknowledgments
Derek Harter—Texas A&M University
Timothy Henry—New England Institute of Technology
Robert Holloway—University of Wisconsin, Madison
Charles Hoot—Oklahoma City University
Teresa Leyk—Texas A&M University
Robert McGlinn—Southern Illinois University, Carbondale
Edward Medvid—Marymount University
Charles Metzler—City College of San Francisco
Daniel Zeng—University of Arizona
Reviewers for the first edition:
David Boyd—Valdosta State University
Dennis Brylow—Purdue University
Michael Croswell—Industry trainer/consultant
Matthew Dickerson—Middlebury College
Robert Holloway—University of Wisconsin, Madison
John Motil—California State University, Northridge
Bina Ramamurthy—University at Buffalo, SUNY
David Surma—Valparaiso University
We continue to appreciate the many others who helped during previous editions. They include Alan
Apt, James Blanding, Lianne Dunn, Mike Giacobbe, Toni Holm, Charles Hoot, Brian Jepson, Rose Kernan,
Christianna Lee, Patrick Lindner, John Lovell, Vince O’Brien, Patty Roy, Walt Savitch, Ben Schomp, Heather
Scott, Carole Snyder, Chirag Thakkar, Camille Trentacoste, Nate Walker, and Xiaohong Zhu.
Finally, we thank our families and friends—Doug, Joanne, Tita, Bobby, Ted, Nancy, Sue, Tom, Maybeth,
Marge, and Lorraine—for giving us lives away from computers.
Thank you, everyone, for your expertise and good cheer.
Frank M. Carrano
Timothy M. Henry

xiii
This page intentionally left blank
Contents

Table of Contents
Introduction: Organizing Data 1
Prelude: Designing Classes 5
Encapsulation 6
Specifying Methods 8
Comments 8
Preconditions and Postconditions 9
Assertions 10
Java Interfaces 11
Writing an Interface 12
Implementing an Interface 13
An Interface as a Data Type 15
Extending an Interface 16
Named Constants Within an Interface 17
Choosing Classes 19
Identifying Classes 20
CRC Cards 21
The Unified Modeling Language 21
Reusing Classes 24
Chapter 1 Bags 31
The Bag 32
A Bag’s Behaviors 32
Specifying a Bag 33
An Interface 39
Using the ADT Bag 41
Using an ADT Is Like Using a Vending Machine 45
The ADT Set 47
Java Class Library: The Interface set 47
Java Interlude 1 Generics 53
Generic Data Types 53
Generic Types Within an Interface 54
Generic Classes 55
Chapter 2 Bag Implementations That Use Arrays 59
Using a Fixed-Size Array to Implement the ADT Bag 60
An Analogy 60
A Group of Core Methods 61
Implementing the Core Methods 62
Making the Implementation Secure 69
Testing the Core Methods 71
Implementing More Methods 73
Methods That Remove Entries 76
Using Array Resizing to Implement the ADT Bag 84
Resizing an Array 84
A New Implementation of a Bag 87
The Pros and Cons of Using an Array to Implement the ADT Bag 90

xv
Java Interlude 2 Exceptions 95
Table of Contents
The Basics 96
Handling an Exception 98
Postpone Handling: The throws Clause 98
Handle It Now: The try-catch Blocks 99
Multiple catch Blocks 100
Throwing an Exception 101
Chapter 3 A Bag Implementation That Links Data 103
Linked Data 104
Forming a Chain by Adding to Its Beginning 105
A Linked Implementation of the ADT Bag 107
The Private Class Node 107
An Outline of the Class LinkedBag 108
Defining Some Core Methods 109
Testing the Core Methods 113
The Method getFrequencyOf114
The Method contains115
Removing an Item from a Linked Chain 116
The Methods remove and clear117
A Class Node That Has Set and Get Methods 121
The Pros and Cons of Using a Chain to Implement the ADT Bag 124
Chapter 4 The Efficiency of Algorithms 129
Motivation 130
Measuring an Algorithm’s Efficiency 131
Counting Basic Operations 133
Best, Worst, and Average Cases 135
Big Oh Notation 136
The Complexities of Program Constructs 138
Picturing Efficiency 140
The Efficiency of Implementations of the ADT Bag 143
An Array-Based Implementation 143
A Linked Implementation 145
Comparing the Implementations 146
Chapter 5 Stacks 153
Specifications of the ADT Stack 154
Using a Stack to Process Algebraic Expressions 158
A Problem Solved: Checking for Balanced Delimiters in an
Infix Algebraic Expression 159
A Problem Solved: Transforming an Infix Expression
to a Postfix Expression 164
A Problem Solved: Evaluating Postfix Expressions 169
A Problem Solved: Evaluating Infix Expressions 171
The Program Stack 173
Java Class Library: The Class Stack174
Chapter 6 Stack Implementations 181
A Linked Implementation 181
An Array-Based Implementation 185

xvi
A Vector-Based Implementation 189

Table of Contents
Java Class Library: The Class Vector 190
Using a Vector to Implement the ADT Stack 190
Chapter 7 Recursion 197
What Is Recursion? 198
Tracing a Recursive Method 202
Recursive Methods That Return a Value 205
Recursively Processing an Array 207
Recursively Processing a Linked Chain 210
The Time Efficiency of Recursive Methods 211
The Time Efficiency of countDown 212
The Time Efficiency of Computing xn 213
A Simple Solution to a Difficult Problem 214
A Poor Solution to a Simple Problem 219
Tail Recursion 221
Indirect Recursion 223
Using a Stack Instead of Recursion 224
Java Interlude 3 More About Generics 235
The Interface Comparable 235
Generic Methods 237
Bounded Type Parameters 238
Wildcards 240
Bounded Wildcards 241
Chapter 8 An Introduction to Sorting 245
Organizing Java Methods That Sort an Array 246
Selection Sort 247
Iterative Selection Sort 248
Recursive Selection Sort 250
The Efficiency of Selection Sort 251
Insertion Sort 251
Iterative Insertion Sort 253
Recursive Insertion Sort 255
The Efficiency of Insertion Sort 257
Insertion Sort of a Chain of Linked Nodes 257
Shell Sort 260
The Algorithm 262
The Efficiency of Shell Sort 263
Comparing the Algorithms 263
Chapter 9 Faster Sorting Methods 271
Merge Sort 272
Merging Arrays 272
Recursive Merge Sort 273
The Efficiency of Merge Sort 275
Iterative Merge Sort 277
Merge Sort in the Java Class Library 277
Quick Sort 278
The Efficiency of Quick Sort 278
Creating the Partition 279

xvii
Implementing Quick Sort 282
Table of Contents
Quick Sort in the Java Class Library 284
Radix Sort 284
Pseudocode for Radix Sort 285
The Efficiency of Radix Sort 286
Comparing the Algorithms 286
Java Interlude 4 More About Exceptions 293
Programmer-Defined Exception Classes 293
Inheritance and Exceptions 297
The finally Block 298
Chapter 10 Queues, Deques, and Priority Queues 301
The ADT Queue 302
A Problem Solved: Simulating a Waiting Line 306
A Problem Solved: Computing the Capital Gain in a Sale of Stock 312
Java Class Library: The Interface Queue 315
The ADT Deque 316
A Problem Solved: Computing the Capital Gain in a Sale of Stock 319
Java Class Library: The Interface Deque 320
Java Class Library: The Class ArrayDeque 321
The ADT Priority Queue 321
A Problem Solved: Tracking Your Assignments 323
Java Class Library: The Class PriorityQueue 325
Chapter 11 Queue, Deque, and Priority Queue Implementations 331
A Linked Implementation of a Queue 332
An Array-Based Implementation of a Queue 336
A Circular Array 336
A Circular Array with One Unused Location 339
Circular Linked Implementations of a Queue 344
A Two-Part Circular Linked Chain 345
Java Class Library: The Class AbstractQueue 350
A Doubly Linked Implementation of a Deque 351
Possible Implementations of a Priority Queue 355
Chapter 12 Lists 361
Specifications for the ADT List 362
Using the ADT List 369
Java Class Library: The Interface List 373
Java Class Library: The Class ArrayList 373
Chapter 13 A List Implementation That Uses an Array 379
Using an Array to Implement the ADT List 380
An Analogy 380
The Java Implementation 382
The Efficiency of Using an Array to Implement the ADT List 390
Chapter 14 A List Implementation That Links Data 397
Operations on a Chain of Linked Nodes 398
Adding a Node at Various Positions 398
Removing a Node from Various Positions 402
The Private Method getNodeAt 403

xviii
Beginning the Implementation 404

Table of Contents
The Data Fields and Constructor 405
Adding to the End of the List 407
Adding at a Given Position Within the List 408
The Methods isEmpty and toArray 409
Testing the Core Methods 411
Continuing the Implementation 412
A Refined Implementation 415
The Tail Reference 415
The Efficiency of Using a Chain to Implement the ADT List 418
Java Class Library: The Class LinkedList 420
Java Interlude 5 Iterators 427
What Is an Iterator? 427
The Interface Iterator 429
The Interface Iterable 431
Using the Interface Iterator 431
Iterable and for-each Loops 435
The Interface ListIterator 436
The Interface List Revisited 439
Using the Interface ListIterator 440
Chapter 15 Iterators for the ADT List 443
Ways to Implement an Iterator 444
A Separate Class Iterator 444
An Inner Class Iterator 447
A Linked Implementation 448
An Array-Based Implementation 451
Why Are Iterator Methods in Their Own Class? 454
An Array-Based Implementation of the Interface ListIterator 456
The Inner Class 457
Java Interlude 6 Mutable and Immutable Objects 469
Mutable Objects 470
Immutable Objects 472
Creating a Read-Only Class 472
Companion Classes 474
Chapter 16 Sorted Lists 477
Specifications for the ADT Sorted List 478
Using the ADT Sorted List 481
A Linked Implementation 482
The Method add 483
The Efficiency of the Linked Implementation 490
An Implementation That Uses the ADT List 490
Efficiency Issues 493
Java Interlude 7 Inheritance and Polymorphism 499
Further Aspects of Inheritance 499
When to Use Inheritance 499
Protected Access 500
Abstract Classes and Methods 501
Interfaces Versus Abstract Classes 503
Polymorphism 504
xix
Chapter 17 Inheritance and Lists 511
Table of Contents
Using Inheritance to Implement a Sorted List 512
Designing a Base Class 514
Creating an Abstract Base Class 519
An Efficient Implementation of a Sorted List 521
The Method add 521
Chapter 18 Searching 527
The Problem 528
Searching an Unsorted Array 528
An Iterative Sequential Search of an Unsorted Array 529
A Recursive Sequential Search of an Unsorted Array 530
The Efficiency of a Sequential Search of an Array 532
Searching a Sorted Array 532
A Sequential Search of a Sorted Array 532
A Binary Search of a Sorted Array 533
Java Class Library: The Method binarySearch 538
The Efficiency of a Binary Search of an Array 538
Searching an Unsorted Chain 539
An Iterative Sequential Search of an Unsorted Chain 540
A Recursive Sequential Search of an Unsorted Chain 540
The Efficiency of a Sequential Search of a Chain 541
Searching a Sorted Chain 541
A Sequential Search of a Sorted Chain 541
A Binary Search of a Sorted Chain 542
Choosing a Search Method 542
Java Interlude 8 Generics Once Again 549
More Than One Generic Type 549
Chapter 19 Dictionaries 551
Specifications for the ADT Dictionary 552
A Java Interface 556
Iterators 557
Using the ADT Dictionary 558
A Problem Solved: A Directory of Telephone Numbers 559
A Problem Solved: The Frequency of Words 564
A Problem Solved: A Concordance of Words 567
Java Class Library: The Interface Map 570
Chapter 20 Dictionary Implementations 575
Array-Based Implementations 576
An Unsorted Array-Based Dictionary 576
A Sorted Array-Based Dictionary 581
Linked Implementations 586
An Unsorted Linked Dictionary 587
A Sorted Linked Dictionary 588
Chapter 21 Introducing Hashing 595
What Is Hashing? 596
Hash Functions 599
Computing Hash Codes 599
Compressing a Hash Code into an Index for the Hash Table 602
xx
Resolving Collisions 603

Table of Contents
Open Addressing with Linear Probing 603
Open Addressing with Quadratic Probing 608
Open Addressing with Double Hashing 609
A Potential Problem with Open Addressing 611
Separate Chaining 612
Chapter 22 Hashing as a Dictionary Implementation 619
The Efficiency of Hashing 620
The Load Factor 620
The Cost of Open Addressing 621
The Cost of Separate Chaining 623
Rehashing 624
Comparing Schemes for Collision Resolution 625
A Dictionary Implementation That Uses Hashing 626
Entries in the Hash Table 626
Data Fields and Constructors 627
The Methods getValue, remove, and add 629
Iterators 634
Java Class Library: The Class HashMap 635
Jave Class Library: The Class HashSet 636
Chapter 23 Trees 639
Tree Concepts 640
Hierarchical Organizations 640
Tree Terminology 642
Traversals of a Tree 646
Traversals of a Binary Tree 647
Traversals of a General Tree 649
Java Interfaces for Trees 650
Interfaces for All Trees 650
An Interface for Binary Trees 651
Examples of Binary Trees 652
Expression Trees 653
Decision Trees 654
Binary Search Trees 658
Heaps 660
Examples of General Trees 663
Parse Trees 663
Game Trees 663
Chapter 24 Tree Implementations 673
The Nodes in a Binary Tree 674
A Class of Binary Nodes 675
An Implementation of the ADT Binary Tree 676
Creating a Basic Binary Tree 677
The Method privateSetTree 678
Accessor and Mutator Methods 681
Computing the Height and Counting Nodes 681
Traversals 682
An Implementation of an Expression Tree 687

xxi
General Trees 688
Table of Contents
A Node for a General Tree 688
Using a Binary Tree to Represent a General Tree 689
Java Interlude 9 Cloning 697
Cloneable Objects 697
Cloning an Array 703
Cloning a Chain 706
A Sorted List of Clones 709
Cloning a Binary Node 711
Chapter 25 A Binary Search Tree Implementation 713
Getting Started 714
An Interface for the Binary Search Tree 715
Duplicate Entries 717
Beginning the Class Definition 718
Searching and Retrieving 719
Traversing 720
Adding an Entry 721
A Recursive Implementation 722
An Iterative Implementation 725
Removing an Entry 726
Removing an Entry Whose Node Is a Leaf 727
Removing an Entry Whose Node Has One Child 727
Removing an Entry Whose Node Has Two Children 728
Removing an Entry in the Root 731
A Recursive Implementation 732
An Iterative Implementation 735
The Efficiency of Operations 739
The Importance of Balance 740
The Order in Which Nodes Are Added 740
An Implementation of the ADT Dictionary 740
Chapter 26 A Heap Implementation 753
Reprise: The ADT Heap 754
Using an Array to Represent a Heap 754
Adding an Entry 757
Removing the Root 760
Creating a Heap 763
Heap Sort 766
Chapter 27 Balanced Search Trees 775
AVL Trees 776
Single Rotations 776
Double Rotations 779
Implementation Details 783
2-3 Trees 787
Searching a 2-3 Tree 788
Adding Entries to a 2-3 Tree 789
Splitting Nodes During Addition 791
2-4 Trees 792
Adding Entries to a 2-4 Tree 793
Comparing AVL, 2-3, and 2-4 Trees 795
xxii
Red-Black Trees 796

Table of Contents
Properties of a Red-Black Tree 797
Adding Entries to a Red-Black Tree 798
Java Class Library: The Class TreeMap 804
B-Trees 804
Chapter 28 Graphs 811
Some Examples and Terminology 812
Road Maps 812
Airline Routes 815
Mazes 815
Course Prerequisites 816
Trees 816
Traversals 817
Breadth-First Traversal 818
Depth-First Traversal 819
Topological Order 821
Paths 824
Finding a Path 824
The Shortest Path in an Unweighted Graph 824
The Shortest Path in a Weighted Graph 827
Java Interfaces for the ADT Graph 830
Chapter 29 Graph Implementations 841
An Overview of Two Implementations 842
The Adjacency Matrix 842
The Adjacency List 843
Vertices and Edges 844
Specifying the Class Vertex 845
The Inner Class Edge 847
Implementing the Class Vertex 848
An Implementation of the ADT Graph 851
Basic Operations 851
Graph Algorithms 854
Appendix A Documentation and Programming Style 861
Naming Variables and Classes 861
Indenting 862
Comments 862
Single-Line Comments 863
Comment Blocks 863
When to Write Comments 863
Java Documentation Comments 863
Appendix B Java Basics (online)
Introduction
Applications and Applets
Objects and Classes
A First Java Application Program
Elements of Java
Identifiers
Reserved Words
Variables
xxiii
Other documents randomly have
different content
the purpose of restoring suspended animation,—while the
highwayman still looked on with a kind of mechanical attention.
At length Georgiana opened her eyes slowly; but the moment they
caught a glimpse of Lord Ellingham's countenance, a faint cry
escaped her lips—and she covered her face with her hands as if to
shut out some terrible object from her view.
"Georgiana, dearest—'tis I," murmured Arthur in her ear.
But a dreadful shudder seemed to convulse her entire frame.
"Some one has terrified her—alarmed her!" exclaimed the Earl,
colouring with anger; and as he glanced rapidly around, his eyes
met those of the highwayman.
At that moment Dr. Lascelles desired that Lady Hatfield should be
supported to her own chamber; and this suggestion was
immediately followed by the female friends and servants, the
physician accompanying them.
CHAPTER XLIII.
LORD ELLINGHAM AND TOM RAINFORD.

Lord Ellingham and Sir Ralph Walsingham remained behind in the


apartment, where Rainford also still was.
"Sir," said the nobleman, advancing towards the highwayman, "you
will perhaps be kind enough to explain the cause of her ladyship's
emotion?—for the scream which reached our ears, and the condition
in which we found her, denote something more serious than sudden
indisposition. This gentleman, sir," added the Earl, indicating Sir
Ralph Walsingham with a glance, "is Lady Hatfield's uncle: you
therefore need not hesitate to address yourself to him—even should
you decline to vouchsafe an explanation to me, who am a total
stranger to you."
"Yes, my lord—for I know you well by sight—we are total strangers
to each other," replied Rainford in a singularly mournful tone. "And
yet——"
But he stopped short, seized his hat, and was about to hasten from
the room, when the Earl caught him somewhat rudely by the arm,
saying,—"Mr. Rainford—for such I believe to be your name—we
cannot part with you thus! A lady—dear, very dear to me, and who
indeed will shortly be my wife,—dear also to Sir Ralph Walsingham,
who is now present,—that lady has been alarmed—terrified in some
manner, by you; and we must insist upon an explanation."
"My lord," returned Tom Rain in a tone of deep emotion, as he gazed
with peculiar—almost scrutinising attention upon the Earl's
countenance,—"no other man on earth would thus have dared to
stop me with impunity. As for explanations," he continued, his voice
suddenly assuming a little of its usual reckless indifference, "I have
none to give."
And again he moved towards the door.
But Lord Ellingham hastened to place his back against it in a
determined manner: while Rainford, as if discouraged and daunted,
fell back a few paces.
"Mr. Rainford," exclaimed the Earl, "this matter cannot pass off thus.
I insist upon an explanation; or I shall consider it to be my duty to
detain you until Lady Hatfield be sufficiently recovered to declare the
nature of the treatment she has experienced at your hands.
Moreover, sir," added the nobleman, observing that Rainford's lip
blanched and quivered nervously, "you are to a certain degree an
object of suspicion in my eyes. A variety of circumstances have
combined to prove to me that you were implicated, to some degree,
in the theft of diamonds which lately caused so much
embarrassment at the police-court."
"My lord, that business does not regard you," replied the
highwayman. "The diamonds were restored to their lawful owner;
and—more than that—I even ascertained from Mr. Gordon's own lips
that they were paid for, before their restoration, by one who——But
let me depart, my lord, I say!" ejaculated Tom, his manner suddenly
changing from nervous trepidation to the excitement of impatience.
"You must remain here, sir," said Arthur coldly, "until we ascertain
whether it be Lady Hatfield's pleasure that your detention should
assume a more serious aspect."
"Allow me to pass, my dear Earl," exclaimed Sir Ralph; "and I will
hasten to ascertain how my niece is now, and what her intentions
are with respect to this person."
Rainford paced the room in an agitated manner, while Lord
Ellingham afforded egress to the baronet, and then resumed his
position of sentinel with his back placed against the door.
"My lord," at length said the highwayman, advancing close up to the
Earl, and speaking in a low, oppressed tone, "you will find that her
ladyship has no complaint to make against me. Permit me to take
my departure; and again I tell you that of no other living soul would
I solicit as a favour what I would command by force."
"I cannot allow you to leave this room—at least until the return of
Sir Ralph Walsingham," answered the Earl. "Lady Hatfield must have
been insulted or menaced by you in some way——"
"I take God to witness that I neither insulted nor menaced her!"
interrupted Rainford, warmly.
"If your liberty be endangered," said the nobleman, "it is well worth
a falsehood to attempt to avert the peril."
"My God! this from him!" muttered Rainford bitterly to himself, as he
once more turned round to pace the room: then, at the expiration of
a minute, he said in a calmer tone, "Well, my lord—I am content to
wait until the decision of her ladyship is made known in respect to
me. And since it appears that we shall have a few moments more of
each other's society, permit me to ask,—your lordship having just
now alluded to a certain transaction at a police-court,—permit me to
ask, I say, whether you really believe that Miss Esther de Medina
was innocent or guilty of the charge imputed to her?"
"This is rather a singular question—coming from you, Mr. Rainford!"
exclaimed the Earl; "and before I answer it, allow me to ask whether
it was not you who left a certain letter at my house, desiring me to
repair to the police-office on that occasion?"
"I will not deny the fact, my lord," replied Rainford. "Indeed, I did
not particularly study concealment respecting it—else would I not
have afforded your lordship's servants an opportunity of describing
to you the personal appearance of the individual who left that letter.
But if your lordship entertains even the shadow of a suspicion
injurious to the character of Miss de Medina, you are wrong—you are
in error!—yes—as grievously in error as ever mistaken man could be.
Besides, my lord," added Rainford hastily, "you are well aware that
the alibi which your lordship proved was correct."
"And how knew you that Miss de Medina was with her father and
myself at Finchley on the very day, and at the very hour, when the
diamonds were alleged to have been taken?" demanded the Earl.
"It would be useless to pretend that accident gave me the
information," answered Tom Rain. "But think not that she employed
me as an agent or as a messenger to obtain the intervention of your
lordship——"
"Mr. Rainford," said the Earl haughtily, "I dislike the present
conversation. I have the highest opinion of Mr. de Medina, and
should be sorry to think ill of any one connected with him. But I
must candidly confess that there is so much mystery respecting the
character of his daughter—a mystery, too, existing on account of
yourself, for which reason alone do I condescend to discuss with you
any affair relating to Mr. de Medina or his family——"
"Lord Ellingham," interrupted Rainford in a hasty and impetuous
tone, "Esther de Medina is the very personification of innocence and
virtue! As God is my judge, she was ignorant of my interference in
her behalf on that day when she was accused of a deed from which
her pure soul would recoil with horror:—she knew not even that I
was in the court——"
"And yet you were there, Mr. Rainford," exclaimed the Earl: "for I
noticed you—although at the time I knew not who you were."
"But Miss de Medina was not aware of my presence," rejoined
Rainford emphatically; "for she does not know me by sight!"
A smile of incredulity curled the nobleman's lip—for the oath which
Mr. de Medina had administered to his daughter, and in which her
connexion with Rainford was so emphatically mentioned, was
uppermost in his mind. But he dared not allude to that circumstance;
although he would have been truly rejoiced to receive the conviction
that Esther was indeed far different from what he was at present
compelled to believe her to be.
"Your lordship said ere now," resumed Tom Rain, "that you noticed
me in the court, although at the time you knew not who I was.
Those were your words. Does your lordship now know who I am?"
"I cannot boast of a very intimate acquaintance with you or your
affairs, Mr. Rainford," returned the nobleman with a hauteur
bordering on contempt; "and what I do know of you is so little in
your favour that you see I am detaining you here on the suspicion
that your visit to Lady Hatfield was for no good purpose. In fact, the
first I ever heard of you was in reference to the charge on account
of which you yourself figured at Bow Street some short time since,—
a charge of which, I am bound to say, you were honourably
acquitted, Lady Hatfield having satisfactorily proved that you were
not the person who robbed her on the highway."
"Thus far, my lord," said Rainford, "you have no just ground to speak
disparagingly of my character."
"Certainly not. But then comes the affair of the diamonds; and I do
not hesitate to inform you that Mr. Gordon related to me all the
particulars of your interview with him, when you called to restore the
jewels, and when he made you aware of the fact that Miss de
Medina had already been to pay him the full value thereof."
"Ah! Mr. Gordon was thus communicative?" observed Rainford.
"Yes—and not sparing of his aspersions against the character of Miss
de Medina," returned the Earl. "But I defended her, Mr. Rainford—I
defended her then——"
"And wherefore should you not defend her now, my lord?"
demanded the highwayman. "Oh! were I to reveal to you by what
wondrous combination of circumstances——But, no! I dare not. And
yet, my lord," he added in an earnest, solemn tone, "you are an
upright—a generous-hearted man; and I appeal to your good
feelings—I implore you not to trust to outward appearances. As
there is a God above, Esther de Medina is innocent of every thing—
any thing that scandal or misconception may have imputed to her.
Again you smile incredulously—and yet mournfully, my lord! Ah! I
can assure you, that Esther is innocent—oh! believe her to be
innocent!"
At this moment footsteps were heard approaching the door, which
Lord Ellingham accordingly opened; and Sir Ralph Walsingham re-
appeared.
"How is Georgiana now?" inquired the nobleman hastily.
"My niece is ill—very ill," returned the baronet.
"Ill!" ejaculated Arthur. "Ah! villain—this is your work!" he cried,
rushing towards the highwayman.
"Keep off!" thundered Rainford: "you know not whom you would
strike!"
"No—touch him not!" cried Sir Ralph, catching the Earl by the arm,
and holding him back. "I have seen my niece—Dr. Lascelles is now
alone with her: she is more composed—though very far from well;—
and she begs that this person may be allowed to depart without the
slightest molestation."
"Her ladyship shall be obeyed, Sir Ralph," returned the nobleman.
"Mr. Rainford, you have heard the message that has been sent
relative to yourself."
Having thus spoken, Arthur turned aside;—for a strange misgiving—
a vague suspicion—no, not a suspicion either,—but a feeling of
dissatisfaction had stolen into his mind. If Rainford had alarmed or
insulted Lady Hatfield, wherefore should she allow him to go
unpunished? Was it not more probable that he had brought her
some evil tidings? But how could there exist any connexion, however
remote or slight, between that man of equivocal character and
Georgiana Hatfield? What business could possibly bring them
together, and produce so strange—so powerful an impression upon
her?
All these ideas rushed to the Earl's mind in rapid and bewildering
succession; and the reader need not be astonished if we repeat that
a sentiment of dissatisfaction—almost amounting to a vague
suspicion, but of what he knew not—had suddenly taken a firm hold
of his imagination.
Who was this Rainford, after all? Was he other than he seemed?
Could he be in any way connected with that narrative of the Black
Mask which the Earl supposed to have partially affected his
Georgiana's mind, and which he looked upon as the cause of that
apparent fickleness or caprice which had first led her to refuse his
proffered hand? The more he involved himself in conjecture, the
deeper did he plunge into a labyrinth which grew darker and more
bewildering at every step.
When he turned round again towards the place where he had left
Rainford standing, that individual was gone; and the noblemen was
alone with Sir Ralph Walsingham.
"You have seen Georgiana?" said Arthur, advancing towards the
baronet and grasping his hand with the convulsive violence of deep
emotion.
"I have, my dear Earl; and she appears as if she had received some
severe shock," was the reply.
"What, in the name of God! does all this mean?" exclaimed the
nobleman, with wildness in his tone.
"I know not—I cannot comprehend it," answered the uncle, as much
bewildered as the lover.
"But did you not question your niece? did she offer no explanation?
did she not state the cause of her emotion—that piercing scream—
that fainting—that movement of horror when she recovered?"
demanded the Earl, impatiently.
"I questioned her; but, perceiving that it only augmented her
agitation, I did not press a painful interrogatory," replied Sir Ralph.
"When I informed her that you had detained that man, whom I
heard you address by the name of Rainford, and whom I therefore
supposed to have been the person suspected of robbing my niece,—
when I informed her that you had detained him, I say, she was
greatly excited, and desired me to hasten and request you to allow
him to depart immediately, as she had no cause of complaint against
him."
"Strange!—most strange!" murmured the Earl.
"Have patience, my dear Arthur," said Sir Ralph. "To-morrow
Georgiana will be better; and then she will doubtless explain——"
"To-morrow—to-morrow!" repeated the nobleman impatiently. "Oh!
what suspense—what terrible suspense! Ah! Sir Ralph, you know not
how wretchedly will pass the weary hours of this night! If I could but
see her—only for a moment! Would it be indiscreet? Dear Sir Ralph,
have pity upon me, and ask Lascelles to come and speak to me."
The baronet, who was a kind-hearted man, instantly departed to
execute this commission; and in a few minutes he returned,
accompanied by the physician.
To the latter the Earl repeated the same question which he had
already addressed to Sir Ralph Walsingham:—"What, in the name of
God! does all this mean?"
And the Doctor gave almost a similar reply:—"I know not—I cannot
understand it."
But there was less sincerity in this answer as given by Lascelles than
there was in the same response as uttered from the heart by the
frank and honest baronet:—for the physician had his suspicions
relative to the mysterious connexion which now appeared to subsist
between Lady Hatfield and the individual whose visit had caused so
much painful excitement.
"That villain Rainford! I am sorry even now that I suffered him to
escape!" ejaculated the Earl, scarcely knowing how to act or speak.
"Rainford!" cried the physician. "Why, that is the name of the man
who was taken up on suspicion of having robbed her ladyship near
Hounslow!"
"And that was Thomas Rainford who was here ere now!" returned
Arthur, with bitter emphasis, as if he hated the name.
"Rainford!" repeated the physician, in astonishment. "I thought that
man's name was Jameson?"
The reader will remember that such was the denomination under
which the highwayman passed when residing in South Moulton
Street.
"What! do you know him?" demanded the Earl, gazing upon the
doctor with unfeigned surprise.
"I once attended a patient at his abode," was the laconic reply: for
Lascelles remembered the solemn promise which he had made to
Tom Rain on that occasion.
"And where did he live?" inquired Arthur, eagerly. "I may wish to see
that man again."
"Where he lived then, he does not live now," returned the physician;
"for he moved away the very next day after I was called in; and
whither he went to, the people of the house knew not."
"I believe him to be a man of bad character," observed Arthur
hastily. "But enough of him—at least for the present. Doctor, can I
be permitted to see Lady Hatfield for a few minutes?"
"Impossible for to-night, my dear Earl," replied the physician. "Her
ladyship is in a state of nervous agitation—feverish excitement,
indeed,—and must not be disturbed. Her maids are now with her,
and she is about to retire to rest. To-morrow, my dear Ellingham,
you shall see her—that is, provided she is more composed."
"Then must I submit to this weary night of suspense!" exclaimed the
young nobleman. "But to-morrow, Doctor, I may see her. You have
promised that I shall see her to-morrow! My visit will be somewhat
early. Will it be indiscreet if I call at eleven?"
"Call at eleven, then," returned the physician, smiling at his friend's
impatience. "But I think I ought to administer a composing draught
to you."
The Earl and Sir Ralph Walsingham shook hands with Dr. Lascelles,
and took their departure. The other guests had already gone; but
the physician remained behind to see his fair patient once more ere
he returned home.
When Lascelles found himself alone in the apartment which the
young nobleman and the baronet had just left, he fell into a train of
reflection which, like the Earl's state of mind, was strangely
characterised by perplexity. Were the Doctor's thoughts put into
words, they would assume as nearly as possible the ensuing shape:

"Well, this is an evening of unpleasant adventure! That Jameson, or
Rainford, or whatever his name is, has brought confusion and
dismay into the house. Perplexities increase rapidly. I remember all
that Ellingham said to me the day that he called to inform me that
he was the happiest of men, and that her ladyship had accepted
him. He declared then that he knew all—that he would never allow
what must be considered a misfortune to stand in the way of his
happiness—and so on. I also remember complimenting him on his
moral courage in rising superior to a common prejudice; and then
we dropped the conversation because we agreed that it was a
delicate subject. And so it was, too: a devilish delicate subject! And I
had found out the grand secret by stealth! Ah! the effects of that
opiate were powerful, and she has never suspected that I did find
out the secret. But Ellingham scarcely seems to have his wits about
him; or else he must suspect the object of this Rainford's visit. It's as
clear as day-light! Rainford is the man—and now he wants to extort
money from her ladyship. But Ellingham cannot put two and two
together as I can:"—and the physician rubbed his hands
complacently, little suspecting that his sapient conjecture relative to
the object of the highwayman's visit was totally wrong, as the reader
is aware.—"This Rainford is an extraordinary character; and I do
believe that he really robbed her ladyship, but that she did not dare
say so in the police-court. He has the cut of a dashing fellow who
would as soon rifle a pocket as drink a bumper of wine. Curse him,
for having intruded on the mysteries of my laboratory! Oh! if
Ellingham only knew what I know about the beautiful Esther de
Medina—the charming Jewess! What deceivers some women are! To
look on Esther, one would think she was purity itself? And yet——"
The physician's reverie was interrupted by the entrance of a female
servant, who came to inform him that Lady Hatfield had retired to
her bed, and that the Doctor might now visit her again. He
accordingly repaired to her chamber, and having prescribed some
composing medicine, took his departure, without once alluding to
the incidents of the evening; for he was anxious that Georgiana's
mind should remain as free from causes of excitement and agitation
as possible.
CHAPTER XLIV.
MR. FRANK CURTIS AGAIN.

In the meantime, Thomas Rainford had quitted the abode of Lady


Hatfield with a heavy heart: for the duty which he had felt himself
called upon to perform, in making a particular statement to
Georgiana, had pained—acutely pained his generous soul.
He had not proceeded many yards from that lady's dwelling, when
he suddenly encountered Mr. Frank Curtis; and as at that precise
moment the glare of a lamp streamed full upon Rainford's
countenance, he was immediately recognised by that impertinent
young gentleman.
"Ah! Captain Sparks!" ejaculated Frank: "so we meet again, do we?
Well, it's very fortunate that I did not accept my friend the Duke's
invitation to his select dinner-party; or else I should have missed this
pleasure. Now what is to prevent me from collaring you, my fine
fellow, and raising a hue and cry?"
"Fear, Mr. Curtis—fear will prevent you," returned Tom Rain,
recovering all his wonted presence of mind: and, taking the young
man's arm, he said, "Walk a little way with me. I want to have a few
minutes' chat with you. Here—put your hand on my great coat
pocket: that's right! Now you can feel a pistol inside—eh? Well its
companion is in the other pocket; and you must know enough of me
already, to be fully aware that any treachery on your part would
meet with its reward; for I would shoot you in the open street, if you
attempted to place my liberty in danger."
"I'm sure I—I don't want to injure you, Captain Sparks," stammered
Frank, trembling from head to foot as he walked along, arm-in-arm
with the highwayman. "I always took you for a capital fellow—and I
should very much like to drink a bottle of wine with you. What do
you say? Shall we go into the Gloucester, or Hatchett's——"
"Neither one nor the other, Mr. Curtis," interrupted Rainford. "I thank
you for your civility all the same."
"Oh! it's nothing, Captain. I learnt politeness in France, where, to be
sure, I had excellent—I may say peculiar advantages. The King was
very much attached to me—and as for the ladies of the Court—Oh!
don't ask me to speak about them, Captain Sparks!"
"Indeed I will not," returned Tom drily. "I want you to let me know
how your uncle gets on. Does he still remember that pleasant little
adventure—ha! ha!"—and the highwayman's merry laugh denoted
that his spirits were reviving once more.
"Sir Christopher! Oh! the old fool—don't talk to me about him!"
ejaculated Frank Curtis. "I have done with my uncle—I shall cut him
—I can never speak to him again, Captain Sparks. He has disgraced
himself—disgraced his family, which was a very ancient one——"
"I always thought Sir Christopher made a boast of having risen from
nothing?" said Tom ironically.
"Ah! so he did. But that was only a part of his system of gammoning
people," continued Frank. "His family was originally the celebrated
Blondevilles of France: about three thousand years ago they settled
in Scotland, and their name was corrupted to Blundevil;—then a
branch came to England about fifteen hundred years ago, and in
process of time they spelt their name with a t—Bluntevil. At last the
e was left out, and it became Bluntvil; and God only knows why, but
three hundred and seventy-seven years ago, come next Michaelmas,
the vil was dropped, and the name settled down into simple Blunt.
So you see, Captain, that Sir Christopher is of a good family after
all."
"Why don't you try and get a situation in the Herald's College?"
demanded Rainford. "You would be able to find pedigrees for all the
Browns, Jones's, Thompsons, and Smiths in the country."
"Come—come, Captain Sparks," exclaimed Frank: "this observation
isn't fair on your part. I may have my faults—I know I have; but I
don't shoot with the long bow. I hate that kind of thing!"
"But let us return to the subject of your uncle Sir Christopher," said
Tom. "What has he been doing?"
"Run away with a lady's-maid—gone to Gretna with Lady Hatfield's
female servant Charlotte!" cried Frank, with great bitterness of tone.
"The damned old fool!—but I'll cut him—cut him dead—and that's
some consolation."
"Gone to Gretna with Lady Hatfield's maid!" exclaimed Rainford.
"Maid, indeed! I hope he'll find her so!" said Curtis. "The hussey! But
I'll be even with her yet!"
"And when did this happen?" inquired Tom.
"Oh! only a few days ago. They are not come back yet. I dare say
Sir Christopher already repents his bargain. But I'll cut him!"
"I'm afraid if you cut his acquaintance, he'll cut off your supplies,"
observed Rainford jocosely.
"And what does that matter?" ejaculated Frank. "Do you think there
are no rich women in London that would be glad to have a decent-
looking fellow like myself. Egad! I've already got introduced to a
widow as wealthy as if her late husband had been a Nabob. It's true
that she's blest with five pledges of the said late husband's affection;
but then she's got five thousand a-year—and one five is a good set-
off against the other, Captain Sparks. Rather so—eh? old fellow?"
"Well, I think it is," returned the highwayman. "But how did all this
happen about Sir Christopher and the lady's-maid?"
"I'll tell you," answered Curtis. "You see, Sir Christopher was going
to run away with Miss Mordaunt, Lady Hatfield's friend, and I found
it out in one of my clever ways. So I resolved to baulk Sir
Christopher; and I bribed this lady's-maid Charlotte—in fact, I gave
her five hundred pounds and a gold watch, the hussey!—to go to
the appointment, get into the carriage, personate Miss Julia
Mordaunt, and keep up the farce until they got to St. Alban's, where
me and a parcel of my friends were to be at the inn to receive them.
That was to be the joke."
"And how did the joke turn so completely against yourself?" asked
Tom.
"Why, me and my friends waited—and waited—and waited at the
infernal hotel at St. Alban's; and no Sir Christopher—no Charlotte
came. We had a glorious supper, and made a regular night of it. All
next day we waited—and waited again; but no Sir Christopher—no
Charlotte. 'What the devil can this mean?' thought I to myself. So I
came up to London, leaving my friends at the inn at St. Alban's in
pawn for the bill—for somehow or another none of us had money
enough about us to settle it. Well, when I came back to town, I went
home: that is, you know, to my uncle's house in Jermyn Street; and
there I found a letter that had just come for me by the post. It was
written from some town a good way north, and was from Sir
Christopher. I began to think something was wrong; and sure
enough there was! For, when I opened the letter, I found that my
silly old uncle had written to thank me for throwing in his way a
delightful and most amiable woman, who had consented to take his
name and share his fortune. The letter went on to say that they
were then pretty far on their road to Gretna, and that as they should
stop at St. Alban's as they came back, I might be there, if I chose, to
have the pleasure of handing my aunt out of the carriage. That was
all said to irritate me, you know, Captain Sparks; and most likely that
vixen Charlotte made Sir Christopher write the letter just to annoy
me. But I'll cut them both dead; and we shall see what my precious
aunt—for such she is by this time, I suppose—will say then!"
"This is really a very pleasant little adventure," cried Tom Rain. "But
I think you carried your joke too far, Mr. Curtis; and so it has recoiled
on yourself. Have you seen Mr. Torrens lately?"
"Not I!" exclaimed Curtis. "But don't you confess, Captain, that you
carried matters a trifle too far that night? Never mind the two
thousand pounds: I'm glad my old hunks of an uncle has lost that!
But I allude to the affair of helping the gals to run away. I suppose
you were in league with Villiers all the time?"
"What makes you think that Villiers had any thing to do with the
matter?" inquired Rainford.
"Simply because I don't imagine you carried off the gals for your
own sake. However," continued Frank, "I care but little about the
matter now. I certainly liked Adelais very much at the time; but
there are plenty of others in the world quite as handsome. Besides, I
now see through all Sir Christopher's trickery in wanting me to marry
Miss Torrens in such a deuce of a hurry, and in giving me a separate
establishment. The old bird wanted to commit matrimony himself;
and I should have been poked off with a few paltry hundreds a-
year."
"And so you will now," said Tom. "Or matters may be even worse,
after the trick you endeavoured to play upon your uncle."
"Not a bit of it!" cried Frank. "Had old Blunt's scheme succeeded, I
should have been married to a portionless gal, and forced to live on
whatever he chose to give me. Now that his project has failed, I am
free and unshackled, and can secure myself a position by marriage. I
might even look as high as my friend the Duke's niece; but she is
horribly ill-tempered, and so I think of making an offer of my heart
and hand—I can do the thing well if I like, you know, Captain—to
Mrs. Goldberry, the widow I spoke of just now."
"The name sounds well, I confess," observed Tom. "But did your
uncle never—I mean, did he not instruct his lawyer to adopt any
proceedings about that little affair of the two thousand pounds?"
"Not he, Captain!" exclaimed Frank Curtis. "As far as my uncle is
concerned, you may rest quite satisfied that he will never take any
notice of the business: and Howard wouldn't act without his
instructions."
They had now reached Charing Cross; and Tom Rain, having had
quite enough of Mr. Curtis's company, signified his desire that they
should separate.
"You won't pass an hour with me over a bottle of wine?" said the
young man. "I really should like to have a chat with such a gallant,
dashing fellow as you are, Captain; for you're quite after my own
heart—barring the——"
"The highway business—eh?" cried Tom, laughing. "Why, you cannot
for a minute suppose that it is my regular profession, Mr. Curtis? No
such a thing! I merely eased you of the two thousand pounds for the
joke of it—just as you played off your tricks on Sir Christopher."
"You talk about easing me, Captain," returned Frank; "but I can
assure you that you're the first man that ever got the better of me.
Don't fancy for a moment that I—I'm a coward, Captain Sparks——"
"Far from it, my dear sir," exclaimed Tom. "I know you to be as
brave as you are straight-forward in your conversation. So good
night—and pray take care not to follow me; for I've an awkward
habit of turning round and knocking on the head any one that I
imagine to be watching me."
With these words the highwayman hurried off up the Strand: and
Frank Curtis entered a cigar shop, muttering to himself, "Damn the
fellow! I almost think he meant that for insolence. Egad! if he did,
the next time I meet him——"
But the valiant young gentleman did not precisely make up his mind
what he should do, in the case supposed: and any resentment which
he experienced, speedily evaporated with the soothing influence of a
cheroot.
Meantime Tom Rain pursued his way along the Strand and Fleet
Street, and repaired to the lodgings of Mr. Clarence Villiers in Bridge
Street.
That gentleman was at home, and received his visitor in a very
friendly manner.
"You are most welcome, Captain Sparks," he said; "and the more so
if you intend to pass an hour or two with me; for my aunt is so very
particular that she would take the girls to church with her this
evening; but of course I did not offer to accompany them, as I could
not wear a veil over my face, you know," he added, laughing; "and
were I recognised by Mr. Torrens or any of his friends, attention
would be immediately directed to any ladies who might happen to
be in my company. So I shall not visit Old Burlington Street this
evening; and if you will bear me company over a bottle of wine——"
"I cannot possibly remain many minutes," interrupted Rainford. "In
fact I am going to leave England very shortly——"
"Leave England!" ejaculated Clarence. "I am truly sorry to hear that
announcement—just as we begin to get friendly together."
"Circumstances compel me to take this step," answered Rainford;
"and my time for preparation is short. I have called to-night upon
business—for, in a word, you can do me a service, perhaps, if you
will."
"As if there were any doubt relative to my inclination, provided I
have the power," exclaimed Clarence, who was busily employed in
decanting a bottle of port-wine: then, having placed upon the table
two glasses, which he filled, he said, "You know, Captain Sparks,
that I am under the greatest obligation to you. Through your kind—
your generous intervention, Adelais will be mine. The banns were
published at St. George's, Hanover Square, a second time to-day;
and to-morrow week we shall be united. The bridal breakfast will
take place at my aunt's: shall we not have the pleasure of your
company? Pray, do not refuse me."
"It is impossible—much as I should rejoice at being the witness of
that union which no severe or mercenary father will be able to
subvert," said Rainford in a feeling tone. "My affairs compel me to
leave this country—at least for a time; and for that reason I am
anxious to place in your hands a certain document, the mystery of
which some accident might probably lead you to clear up."
Rainford then produced the letter which had been found about the
person of the deceased Sarah Watts, and which he now requested
Villiers to peruse.
"You observe that there is no address to indicate the name of the
lady to whom that letter was written," continued the highwayman,
when Clarence had read it with attention. "The child to whom it
refers is now in my care: accident threw him in my way—and his
adopted mother, who was the writer of that letter, is no more."
"Will the child accompany you?" asked Villiers.
"He will. But I will write to you the moment I reach America—to
which country I am going—and let you know my address, or at all
events through what channel a letter will come direct to me. Then,
should you have made any discovery—which is however scarcely to
be expected—still, as a wise precaution, I have adopted this step
——"
"You are right, Captain," said Villiers; "and I shall not forget the trust
you have now confided to me. Should anything transpire respecting
this matter, I will not fail to communicate with you. But will you not
pass one evening with me in the society of my aunt and the two
young ladies, who will all be delighted to receive you? Mrs. Slingsby
is a most amiable and excellent woman——"
"A little of a saint—is she not?" exclaimed the highwayman drily.
"She is certainly of a religious turn of mind—indeed, I may say,
enthusiastically so," answered Villiers. "But she is extremely
charitable—and her benevolence embraces a very wide circle."
"I believe she is a handsome woman, too!" observed Tom Rain.
"She is possessed of personal as well as mental attractions, Captain
Sparks," responded Villiers seriously. "But, when in her society, you
would think of her only as the pious—benevolent—and
compassionate woman, whose heart is ever ready to sympathise
with the woes of her fellow creatures."
"To speak candidly, Mr. Villiers," said Rainford, "I am no friend to the
saints. It may be a prejudice on my part—but I can't help it. Excuse
me for my frankness—I beg of you to take it in good part: still I
always think that the stillest water runs deepest; and I would not
——"
"Remember, Captain Sparks," interrupted Villiers, somewhat warmly,
"that you are speaking of my aunt, who is a most worthy and
estimable woman. Deeply as I am indebted to you—much as I am
inclined to esteem you—yet——"
"I understand you, my dear Mr. Villiers," cried Tom: "you cannot
permit me to breathe even a suspicion against Mrs. Slingsby in your
presence. Well—I know that it is most ungracious on my part: still,
as I was more or less instrumental in inducing those too artless,

You might also like