Immediate download Data Structures and Algorithms in C 2nd Edition Michael T. Goodrich ebooks 2024
Immediate download Data Structures and Algorithms in C 2nd Edition Michael T. Goodrich ebooks 2024
com
https://ebookname.com/product/data-structures-and-
algorithms-in-c-2nd-edition-michael-t-goodrich/
OR CLICK BUTTON
DOWNLOAD EBOOK
https://ebookname.com/product/data-structures-and-algorithms-in-
java-5th-international-student-edition-m-t-goodrich-and-r-tamassia/
ebookname.com
https://ebookname.com/product/data-structures-and-algorithms-with-
javascript-1st-edition-michael-mcmillan/
ebookname.com
https://ebookname.com/product/data-structures-using-c-2nd-edition-a-k-
sharma/
ebookname.com
https://ebookname.com/product/testamentary-trusts-strategies-and-
precedents-2nd-edition-edition-charles-rowland/
ebookname.com
https://ebookname.com/product/culinary-calculations-simplified-math-
for-culinary-professionals-1st-ed-edition-jones/
ebookname.com
https://ebookname.com/product/organization-development-the-process-of-
leading-organizational-change-4th-edition-donald-l-anderson/
ebookname.com
https://ebookname.com/product/encyclopedia-of-suicide-3-volume-set-
oliver-b-torres/
ebookname.com
Culture of vengeance fate american justice 1st Edition
Terry K. Aladjem
https://ebookname.com/product/culture-of-vengeance-fate-american-
justice-1st-edition-terry-k-aladjem/
ebookname.com
This page intentionally left blank
i i
i i
i i
This page intentionally left blank
i i
Michael T. Goodrich
Department of Computer Science
University of California, Irvine
Roberto Tamassia
Department of Computer Science
Brown University
David M. Mount
Department of Computer Science
University of Maryland
i i
i i
i i
This book was set in LATEX by the authors and printed and bound by Malloy Lithographers.
The cover was printed by Malloy Lithographers. The cover image is from Wuta Wuta Tjan-
gala, “Emu dreaming” c estate of the artist 2009 licensed by Aboriginal Artists Agency.
Jennifer Steele/Art Resource, NY.
This book is printed on acid free paper. ∞
Trademark Acknowledgments: Java is a trademark of Sun Microsystems, Inc. UNIX R is
a registered trademark in the United States and other countries, licensed through X/Open
Company, Ltd. PowerPoint R is a trademark of Microsoft Corporation. All other product
names mentioned herein are the trademarks of their respective owners.
Copyright c 2011, John Wiley & Sons, Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system or transmitted
in any form or by any means, electronic, mechanical, photocopying, recording, scanning
or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States
Copyright Act, without either the prior written permission of the Publisher, or authorization
through payment of the appropriate per-copy fee to the Copyright Clearance Center, Inc.
222 Rosewood Drive, Danvers, MA 01923, (978)750-8400, fax (978)646-8600.
Requests to the Publisher for permission should be addressed to the Permissions Depart-
ment, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201)748-6011, fax
(201)748-6008, E-Mail: PERMREQ@WILEY.COM.
To order books or for customer service please call 1-800-CALL WILEY (225-5945).
Founded in 1807, John Wiley & Sons, Inc. has been a valued source of knowledge and
understanding for more than 200 years, helping people around the world meet their needs
and fulfill their aspirations. Our company is built on a foundation of principles that include
responsibility to the communities we serve and where we live and work. In 2008, we
launched a Corporate Citizenship Initiative, a global effort to address the environmental,
social, economic, and ethical challenges we face in our business. Among the issues we
are addressing are carbon impact, paper specifications and procurement, ethical conduct
within our business and among our vendors, and community and charitable support. For
more information, please visit our website: www.wiley.com/go/citizenship.
Library of Congress Cataloging in Publication Data
ISBN-13 978-0-470-38327-8
i i
i i
i i
To Isabel
– Roberto Tamassia
To Jeanine
– David M. Mount
i i
i i
This page intentionally left blank
i i
Preface
This second edition of Data Structures and Algorithms in C++ is designed to pro-
vide an introduction to data structures and algorithms, including their design, analy-
sis, and implementation. In terms of curricula based on the IEEE/ACM 2001 Com-
puting Curriculum, this book is appropriate for use in the courses CS102 (I/O/B
versions), CS103 (I/O/B versions), CS111 (A version), and CS112 (A/I/O/F/H ver-
sions). We discuss its use for such courses in more detail later in this preface.
The major changes in the second edition are the following:
• We added more examples of data structure and algorithm analysis.
• We enhanced consistency with the C++ Standard Template Library (STL).
• We incorporated STL data structures into many of our data structures.
• We added a chapter on arrays, linked lists, and iterators (Chapter 3).
• We added a chapter on memory management and B-trees (Chapter 14).
• We enhanced the discussion of algorithmic design techniques, like dynamic
programming and the greedy method.
• We simplified and reorganized the presentation of code fragments.
• We have introduced STL-style iterators into our container classes, and have
presented C++ implementations for these iterators, even for complex struc-
tures such as hash tables and binary search trees.
• We have modified our priority-queue interface to use STL-style comparator
objects.
• We expanded and revised exercises, continuing our approach of dividing
them into reinforcement, creativity, and project exercises.
i i
i i
i i
viii Preface
and deallocation (and the associated issues of destructors), virtual functions, stream
input and output, operator overloading, and C++’s safe run-time casting.
Use as a Textbook
The design and analysis of efficient data structures has long been recognized as a
vital subject in computing, because the study of data structures is part of the core
of every collegiate computer science and computer engineering major program we
are familiar with. Typically, the introductory courses are presented as a two- or
three-course sequence. Elementary data structures are often briefly introduced in
the first programming course or in an introduction to computer science course and
this is followed by a more in-depth introduction to data structures in the courses that
follow after this. Furthermore, this course sequence is typically followed at a later
point in the curriculum by a more in-depth study of data structures and algorithms.
We feel that the central role of data structure design and analysis in the curriculum
is fully justified, given the importance of efficient data structures in most software
systems, including the Web, operating systems, databases, compilers, and scientific
simulation systems.
With the emergence of the object-oriented paradigm as the framework of choice
for building robust and reusable software, we have tried to take a consistent object-
oriented viewpoint throughout this text. One of the main ideas behind the object-
oriented approach is that data should be presented as being encapsulated with the
methods that access and modify them. That is, rather than simply viewing data
as a collection of bytes and addresses, we think of data objects as instances of an
abstract data type (ADT), which includes a repertoire of methods for performing
operations on data objects of this type. Likewise, object-oriented solutions are often
organized utilizing common design patterns, which facilitate software reuse and
robustness. Thus, we present each data structure using ADTs and their respective
implementations and we introduce important design patterns as a way to organize
those implementations into classes, methods, and objects.
For most of the ADTs presented in this book, we provide a description of the
public interface in C++. Also, concrete data structures realizing the ADTs are
discussed and we often give concrete C++ classes implementing these interfaces.
We also give C++ implementations of fundamental algorithms, such as sorting and
graph searching. Moreover, in addition to providing techniques for using data struc-
tures to implement ADTs, we also give sample applications of data structures, such
as HTML tag matching and a simple system to maintain a play list for a digital
audio system. Due to space limitations, however, we only show code fragments of
some of the implementations in this book and make additional source code avail-
able on the companion web site.
i i
i i
i i
Preface ix
Online Resources
This book is accompanied by an extensive set of online resources, which can be
found at the following web site:
www.wiley.com/college/goodrich
Included on this Web site is a collection of educational aids that augment the
topics of this book, for both students and instructors. Students are encouraged to
use this site along with the book, to help with exercises and increase understand-
ing of the subject. Instructors are likewise welcome to use the site to help plan,
organize, and present their course materials. Because of their added value, some of
these online resources are password protected.
i i
i i
i i
x Preface
Table 0.1: Material for units in the IEEE/ACM 2001 Computing Curriculum.
i i
i i
i i
Preface xi
1. A C++ Primer
2. Object-Oriented Design
3. Arrays, Linked Lists, and Recursion
4. Analysis Tools
5. Stacks, Queues, and Deques
6. List and Iterator ADTs
7. Trees
8. Heaps and Priority Queues
9. Hash Tables, Maps, and Skip Lists
10. Search Trees
11. Sorting, Sets, and Selection
12. Strings and Dynamic Programming
13. Graph Algorithms
14. Memory Management and B-Trees
A. Useful Mathematical Facts
A more detailed listing of the contents of this book can be found in the table of
contents.
i i
i i
i i
xii Preface
Prerequisites
We have written this book assuming that the reader comes to it with certain knowl-
edge. We assume that the reader is at least vaguely familiar with a high-level pro-
gramming language, such as C, C++, Python, or Java, and that he or she understands
the main constructs from such a high-level language, including:
• Variables and expressions.
• Functions (also known as methods or procedures).
• Decision structures (such as if-statements and switch-statements).
• Iteration structures (for-loops and while-loops).
For readers who are familiar with these concepts, but not with how they are ex-
pressed in C++, we provide a primer on the C++ language in Chapter 1. Still, this
book is primarily a data structures book, not a C++ book; hence, it does not provide
a comprehensive treatment of C++. Nevertheless, we do not assume that the reader
is necessarily familiar with object-oriented design or with linked structures, such
as linked lists, since these topics are covered in the core chapters of this book.
In terms of mathematical background, we assume the reader is somewhat famil-
iar with topics from high-school mathematics. Even so, in Chapter 4, we discuss
the seven most-important functions for algorithm analysis. In fact, sections that use
something other than one of these seven functions are considered optional, and are
indicated with a star (⋆). We give a summary of other useful mathematical facts,
including elementary probability, in Appendix A.
i i
i i
i i
Preface xiii
Roberto Tamassia received his Ph.D. in Electrical and Computer Engineering
from the University of Illinois at Urbana-Champaign in 1988. He is the Plastech
Professor of Computer Science and the Chair of the Department of Computer Sci-
ence at Brown University. He is also the Director of Brown’s Center for Geometric
Computing. His research interests include information security, cryptography, anal-
ysis, design, and implementation of algorithms, graph drawing, and computational
geometry. He is an IEEE Fellow and a recipient of the Technical Achievement
Award from the IEEE Computer Society for pioneering the field of graph drawing.
He is an editor of several journals in geometric and graph algorithms. He previously
served on the editorial board of IEEE Transactions on Computers.
David Mount received his Ph.D. in Computer Science from Purdue University
in 1983. He is currently a professor in the Department of Computer Science at
the University of Maryland with a joint appointment in the University of Mary-
land’s Institute for Advanced Computer Studies. He is an associate editor for ACM
Transactions on Mathematical Software and the International Journal of Compu-
tational Geometry and Applications. He is the recipient of two ACM Recognition
of Service Awards.
In addition to their research accomplishments, the authors also have extensive
experience in the classroom. For example, Dr. Goodrich has taught data structures
and algorithms courses, including Data Structures as a freshman-sophomore level
course and Introduction to Algorithms as an upper-level course. He has earned sev-
eral teaching awards in this capacity. His teaching style is to involve the students in
lively interactive classroom sessions that bring out the intuition and insights behind
data structuring and algorithmic techniques. Dr. Tamassia has taught Data Struc-
tures and Algorithms as an introductory freshman-level course since 1988. One
thing that has set his teaching style apart is his effective use of interactive hyper-
media presentations integrated with the Web. Dr. Mount has taught both the Data
Structures and the Algorithms courses at the University of Maryland since 1985.
He has won a number of teaching awards from Purdue University, the University of
Maryland, and the Hong Kong University of Science and Technology. His lecture
notes and homework exercises for the courses that he has taught are widely used as
supplementary learning material by students and instructors at other universities.
Acknowledgments
There are a number of individuals who have made contributions to this book.
We are grateful to all our research collaborators and teaching assistants, who
provided feedback on early drafts of chapters and have helped us in developing
exercises, software, and algorithm animation systems. There have been a number of
friends and colleagues whose comments have lead to improvements in the text. We
are particularly thankful to Michael Goldwasser for his many valuable suggestions.
i i
i i
Exploring the Variety of Random
Documents with Different Content
Chapter XXI
Lionel Holland was, of course, mistaken in accepting as genuine
my indifference as to whether the Gascoynes were civil to me or no.
Since they had asked me to their house it was necessary I should
become as intimate as possible, and Lionel could not know how I
had schemed and intrigued to make myself acceptable in their sight.
I had nibbled all round their circle, so to speak, unobtrusively
attempting to identify myself as much as possible with the people
they knew. This was a matter of no little difficulty. I was compelled
to make it known how near I stood to the succession. This gave me
a certain sort of position, and at least tolerance, as more or less one
of themselves by the exclusive set in which the Gascoynes moved.
They still, however, showed no sign of great friendliness. Of course,
the important person to conciliate was Lady Gascoyne. She did not
belong to the difficult set by birth, and was naturally nervous of
doing anything which might show her as a novice in the art of social
selection. Not that she was in any way a snob; indeed, far from it.
She evidently liked me. I was the sort of personality that the
heiress of enterprising American ancestors—the wrong word; her
forbears could hardly be described as ancestors—would like. I had,
however, so far not interested Lord Gascoyne, whose sympathies
were limited. He had asked me to the house in a purely formal way,
and as a member of the family who had a right to be so asked.
So far I had, as it were, been conducting reconnaissances round
the network of his character and temperament in order to discover
his vulnerable point. It was extremely difficult. He was one of those
self-contained Englishmen whose sense of duty comes somewhat as
a surprise in conjunction with an apparently unenthusiastic
temperament. The very person to be a royal substitute in a
dependency. Enthusiasm is the greatest curse that can befall a
reigning Sovereign, and a really sincere, enthusiastic monarch is
distrusted by no one so much as by his own subjects. In his
presence I at once suppressed the artistic side of my character, and
pretended to a reserve and coldness in no way natural to me. Such
topics as were discussed I treated with as much pure reason as was
consistent with a respect to aristocratic prejudices, an attitude
eminently conciliatory to the English noble, who is never so happy as
when he flatters himself that he is displaying liberal tendencies.
There did not, however, appear to be any likelihood of my being
asked to Hammerton, and even my confession that I had visited the
place as a tourist failed to elicit the desired invitation. He was,
because of his limitations, the most difficult person I had yet had to
deal with. At the same time, my being on visiting terms with Lord
and Lady Gascoyne, and admitted by them to be a relative, gave me
a social status which I had not before possessed.
It was highly necessary to be swift with his lordship. I must say
that I had less compunction about removing him than I had had
about any of the others. He was so entirely impersonal in his
relations with the outer world.
I think his wife was in love with him. He was the sort of man
women love desperately where they love at all; for the simple reason
that they are never permitted to become really familiar. They are
always in the presence of their reigning sovereign. A very
wholesome thing for most women, and especially corrective for an
American woman. It had been, I fancy, a great change for her,
inasmuch as before marriage she had ruled her father absolutely. It
was a little surprising that Lord Gascoyne should have condescended
to mingle his blood with what was, after all, quite a plebeian strain.
It was the more surprising as he was in no need of money, and I
discovered afterwards that at his request her enormous dowry was
settled absolutely on her children. I wondered very much if the
dowry would revert to the American relations should she die
childless; also if, in the case of Lord Hammerton outliving his
parents, but dying a minor, the money would pass to the Gascoyne
family. It would certainly be amusing were I to inherit the American
dollars.
The great thing, however, was to secure an invitation to
Hammerton. If I could only render Lord Gascoyne some service, or
place him under an obligation to me in any way, it would probably
follow as a matter of course.
An idea struck me. There was the portrait of Lord George, the
one thing saved from the wreck of my uncle’s home. I knew that
Lord Gascoyne took the greatest pride and interest in the portrait
gallery at Hammerton, and that there was no portrait of Lord George
Gascoyne, my own immediate ancestor, among the family pictures.
Finally, seeing no way of approaching the matter as if by chance,
I wrote and offered him the portrait for the collection at Hammerton,
and he replied asking me to come and see him.
I went, and was shown into his private sanctum. He was,
considering his temperament, quite profuse in his thanks, but would
at first not hear of accepting the portrait as a gift.
“As you say, it is not by a great name,” he said; “but at the same
time it is a very good name, and is worth money, and more than
money, to me.”
I gave him to understand that if he declined it as a gift it would
hurt my feelings, as I should conclude that he did not care about
accepting anything at my hands. This I conveyed to him in as tactful
a way as possible. He saw, however, what I meant, and graciously
accepted the picture.
“You must come down and see it hung.”
He could not very well say less, but by the expression of his face
I wondered whether a vague suspicion of my motive had not, even
as he spoke, entered his mind.
However, the invitation was given, and I intended to avail myself
of it. I had no intention of allowing the matter to slip his memory.
“It must be a week-end,” I said smiling, “for, you know, I work
hard all the week.”
“Lady Gascoyne shall write and ask you. She is at Hammerton
herself at present.”
It was quite unnecessary for his lordship to inform me of Lady
Gascoyne’s whereabouts, for I followed the movements of his
household as closely as he did himself.
At Christmas I paid a flying visit to the Gascoynes in the South of
France, and was welcomed with a curious quietness of passion by
Miss Gascoyne, and like a son by her aunt and uncle.
Miss Gascoyne always exalted me, mentally if not morally, and
even in the latter direction she led me out of the limitations I had
laid down for myself, and beyond which it would be dangerous for
me to venture. I am quite capable of great moral enthusiasm, and it
has always been my habit to keep out of the way of those likely to
infect me with strenuousness.
She talked of ideals quite simply and earnestly, and without the
least suggestion of cant, and I was obliged to find some aspirations
suitable to these occasions. Being a woman in love she was content
to warm her romance at a very small fire, and, further, to imagine it
a very big blaze.
I was terribly afraid of being found out by her in any way. I knew
that once we were married she would die rather than admit that she
had made a mistake. Her loyalty would amount to fanaticism, but
she was a woman who could take strong measures before the
irrevocable was accomplished. Her attitude has been that of a
medieval saint matched with a Cenci. She has held her peace, and
she has professed to believe what she knew to be false; whilst at the
same time she has suffered agonies of abasement.
Nearly all women, however, are deceived in love. It is their
pastime. Some never discover the fact, and dream their lives away
from their marriage-day to the grave. If Miss Gascoyne hardly
possessed the phlegmatic instinct which would enable her to join the
comfortable ranks of the latter, she was none the less dwelling in a
fool’s paradise during those winter days on the Riviera. Those who
considered her cold would have been astonished had they known all.
She was a concealed volcano.
I returned to town a little exhausted by the rarified atmosphere
of reverential romance in which I had been living, and looking
forward with a sense of relief to the decadent fascination of Sibella.
Miss Gascoyne with her Utopian dreams about the life of
usefulness we were to lead required the natural antidote, and,
strangely enough, the first whiff of the perfume Sibella used, wafted
to me across the room as she rose to greet me, banished all
sensation of ever having been bored by Edith, for I never admired
her so much as when I was in the company of Sibella. In the same
way I never longed for Sibella to such an extent as when I was with
Edith.
Amongst the letters which I found waiting when I reached my
rooms there was an invitation from Lady Gascoyne asking me to give
them the following Saturday to Monday at Hammerton.
From the tone of her letter it was obvious that she had been only
too anxious to second her husband’s invitation. To do her justice,
she had no class prejudices, and such exclusiveness as she displayed
arose from her desire that her husband should think her in every
way fitted to her position.
In my daily letter to Miss Gascoyne I mentioned casually that I
had been invited to Hammerton. I knew that there were few things
which would please her so much.
It was a bitterly cold evening in January when I reached
Hammerton station, and it was snowing fast when we drove across
the stone bridge which spanned the old moat and turned in at the
gates.
There was just time to dress for dinner, and, getting into my
evening clothes as quickly as possible, I descended and found that
the only member of the party who had made his appearance was a
young American millionaire who was being introduced to English
society. I thought him particularly stupid and offensive, and was glad
when Lord Gascoyne and the other guests quickly followed and we
went to dinner.
We dined in a long, narrow room with a vaulted ceiling and gray
antique stone walls covered with tapestry. The mixture of a feudal
past with modern luxury was exceedingly grateful to a fastidious
taste. The servants came and went through a low arched door,
which must have been built during the early days of the Norman
Conquest. The walls were covered with antique implements of
battle, whilst imposing suits of armour loomed out of the shadows,
their polished surfaces reflecting here and there the blaze from the
enormous log-fire in the vast chimney-place. The party consisted of
about half a dozen people besides myself. There was the young
millionaire I have already mentioned, and who, I believe, was
destined by Lady Gascoyne for Lady Enid Branksome, a pretty, fair-
haired girl, who was staying at Hammerton with her mother. It is
surprising, when one comes to think of it, how few young Americans
marry English noblewomen. It would be interesting to inquire
whether this reticence is caused by a disinclination to live in America
—where, of course, precedence and rank would have to be dropped
—or whether the American young man does not care to buy
anything in the shape of a title which is not hereditary. It would
certainly be incongruous for Lady Enid Branksome to degenerate
into plain Mrs. Puttock of Philadelphia. It would seem almost a
murder. The Branksomes, however, were poor, and Mr. Puttock was a
multi-millionaire. He was obviously much taken with Lady Enid, who,
on her side, was evidently torn by the convicting claims of love and
interest; for young Sir Cheveley Drummond was also of the party.
This had been a great tactical error on Lady Gascoyne’s part, for he
seemed to find greater favour in Lady Enid’s eyes than did the fat,
unhealthy cheeks and vacuous expression of Mr. Puttock of
Philadelphia. At the same time, a glance at Lady Branksome’s face
impressed one with the idea that the Lady Enid would most probably
be made to do what she was told.
I have nearly always found house parties somewhat dull, unless
there happened to be present a personality of new and surprising
interest, and personalities do not frequent country-houses. But for
the work I was engaged on I might have found the Saturday till
Monday at Hammerton as dull as anything of the kind. It was,
however, of absorbing interest to me to be in the house with two
people whom I had decided on removing. The position pleased me.
This absolutely modern company in a medieval castle, and with a
medieval criminal in their midst, was truly interesting. Lady
Branksome was evidently doubtful about me, but noting the Semitic
cast of my features, and hearing that I was on the Stock Exchange,
concluded that there could only be one reason for my being in such
company, and that must be enormous wealth. Having several other
daughters just ready to burst from the schoolroom into the ranks of
the marriageable, she was tentatively affable. She was the sort of
woman I always found it very easy to get on with; of the world,
cynical and good-natured, very strong-minded, and willing to live
and let live. She was at the same time most intolerant of people
making fools of themselves, and had no intention of allowing those
who were dependent on her to do so if she could help it. Providing
she was assured that I had no intentions, she would be perfectly
friendly, even when she discovered that I was comparatively poor.
Indeed, I gathered in the course of a conversation with her, that she
had quite a weakness for adventurous young men. Probably it was
because she understood them so well that she was such an expert in
keeping them at a distance. During dinner, however, and pending
inquiries which would no doubt be conducted when the ladies were
alone, she treated me as a person rich enough to be conciliated. A
very different woman was Lady Briardale. However rich a man might
be, he was nothing to her unless he could show a pedigree. She
evidently thought very little of Mr. Puttock, and less of Mr. Rank, who
looked a Jew. She probably regarded it as a slight that she should
have been asked to meet two such absolute nobodies. She had
never heard of anybody called Puttock, or Rank. They were not
names at all. They were merely ciphers by which the lower classes
were differentiated one from the other. She would probably have
thought it more convenient if the lower classes had been known by
numbers like cabs and convicts; and, after all, they were not so
interesting as convicts, and not so useful as cabs in her eyes. She
was evidently somewhat annoyed that I should talk so well, a fact
she might have forgiven if others had not paid me the compliment of
listening. Indeed, she became quite civil to Puttock, who, she
perhaps felt, showed himself conscious of his inferiority by holding
his tongue.
Sir Cheveley Drummond, whom I knew to be entertaining, but
who was quite taken up with Lady Enid, completed the party, which
did not promise much amusement.
After dinner we all sat in the picture-gallery. The last time I had
seen it was in company with the gang of excursionists, and I
laughingly recalled the fact to Lady Gascoyne when she was showing
me where the picture of Lord George had been hung. Lady Briardale
was apparently a little astonished when she heard that Lord George
was my ancestor, and that I had presented the picture to the
collection. Lady Branksome had evidently recalled my name.
“I have been wondering, Mr. Rank, where I have heard of you,
and I remember now that it was from my youngest boy. He met you
at supper one evening. I didn’t ask where,” she said parenthetically,
“but he talked of nobody else for days.”
I remembered young Gavan Branksome, a nice, fair-haired youth,
who had attracted my notice by being somewhat like Grahame
Hallward.
“I have not seen him since.”
“No; he is in India. Did you like India, Sir Cheveley?” she said
quickly, stopping the love-sick warrior as he was making his way
across the room to Lady Enid.
Poor Sir Cheveley was forced to pause, and whilst Lady
Branksome detained him, Mr. Puttock sank into the seat which Lady
Enid had left vacant for Sir Cheveley.
“Charming man, Sir Cheveley,” said Lady Branksome, with almost
a laugh when he finally moved away. “I’ve known him all his life, and
he was always attractive, even when he was sixteen.”
I am sure she was perfectly honest in saying that she liked Sir
Cheveley. She probably liked him as much as, in her heart, she
disliked Mr. Puttock.
Poor Sir Cheveley’s disappointment, however, did not prevent his
being excellent company in the smoking-room.
I sat up in my own room thinking matters over till a late hour.
Before I arrived at Hammerton I had had vague ideas of pushing
Lord Gascoyne down a disused well, or something of that kind, in
which an old feudal castle like Hammerton might be supposed to
abound. On consideration, however, I came to the conclusion that
Lord Gascoyne would be a very difficult person to push anywhere he
did not mean to go.
I was naturally afraid of poison in such a case. It would only be
possible to use it whilst I was in the house, and that was dangerous.
My growing proximity to the succession was bringing me nearer and
nearer to the perilous land of motive. Violence, unless I were given
an extraordinarily good opportunity, was out of the question. The
cigar would not do, either, for, strange to say, Lord Gascoyne hardly
smoked at all. Cigars and pipes he never attempted, and I noticed
that as a rule he merely lit a cigarette in order to keep his guests in
countenance.
I had heard of people being made away with when out shooting,
but in my case it would hardly be possible. In the first place, I did
not shoot, having always had a disinclination to the brutal killing of
animals for the sake of pleasure. There remained as far as I could
see only the ordinary means of poisoning, with all their attendant
dangers.
An instantaneous poison would be most convenient, as it was
highly unlikely that I should have sufficient access to Lord Gascoyne
to deal with him slowly.
I rose in the morning with one scheme after another chasing
itself through my brain. Dressing rapidly, I went for a walk before
breakfast round the ancient battlements. These were quite a mile in
circumference, and the climbing of worn steps, hazardous scalings of
the walls from whence to get a better view, and a careful
examination of the various architectural designs of which the
building was constructed, occupied me very pleasantly for a full hour,
and it was half-past nine, the time for breakfast, when I turned to
re-enter the castle. As I descended some steps which led down to
the quadrangle, I was astonished to come face to face with a girl of
about nineteen or twenty and a child. She was obviously a lady, but
she had not been at the dinner-table the evening before, or in the
picture-gallery afterwards. I concluded that she was the little boy’s
governess, but who the child might be I could not imagine. I
detected at once that the girl was beautiful, and when I say I
detected I use the word advisedly, because it was not a beauty
which would be immediately appreciated. The gray eyes, oval face,
threaded gold hair, straight nose, and delicately-cut mouth were
almost too frail to impress the casual observer. I saw at once,
however, that she was rarely perfect in such a type of beauty as I
always imagined Burns’ Mary must have possessed. She wore a
quaint hood, almost like a child’s, edged with some inexpensive gray
fur. The little boy looked at me shyly, and I held out my arms. A
smile broke over his face and he offered me his ball, inviting me to
play with him. In less than a minute we were all three laughing like
old friends.
After having made myself sufficiently agreeable, I escaped from
the child, who was clamouring to me to continue the game, and ran
down the steps. I found Lady Gascoyne in sole possession of the
breakfast-table. “I am afraid we are the only early risers, Mr. Rank,”
she said.
As a matter of fact, I rather fancied I had caught a glimpse of
Lady Enid going along the road towards Hammerton woods, and I
think I was fairly correct in guessing that she was not walking at
such a rapid pace for the pleasure of her own company. Indeed, I
would not have minded taking long odds that Sir Cheveley was not
very far away.
I, of course, said nothing of this to Lady Gascoyne, but
mentioned my meeting with the girl in the gray hood.
Lady Gascoyne smiled.
“Now, isn’t she pretty, Mr. Rank?”
“Almost beautiful,” I hazarded. It is dangerous to be enthusiastic
about another woman, even to the nicest of her sex.
“That shows your good taste. Some people cannot see it.”
“It is the sort of beauty which is very rare, and not exactly
showy.”
“She is to my mind wonderful. It does one good to look at her. I
expect you are wondering who the little boy is. It is a sad story. I
had a great school friend whose father was enormously rich. About a
year after her marriage he failed, and her husband’s fortune went in
the same crash. Her husband shot himself, and she died six months
later, leaving her little boy in my care. Oh!” she added quickly,
evidently afraid that my inward comment might be a disparagement
on her dead friend, “she did so at my express desire. We loved one
another so, that it was the most natural thing she could do.”
“He seems a dear little chap.”
“He is a darling, and devoted to Hammerton already. Lord
Gascoyne is so good about it, and lets me have him here always.
Miss Lane is his governess.”
Sir Cheveley Drummond, looking a little conscious, came in at
this moment.
“How energetic everybody is this morning,” said Lady Gascoyne.
Mr. Puttock, who appeared on the scene almost as she spoke,
looked anything but energetic. He looked as effete as only a
decadent young American can look. Lady Enid, who followed,
managed to convey with great art the impression that she had just
left her room. Lady Briardale did not appear, but Lady Branksome,
unable to trust Lady Enid, arrived in good time, although she
confided to me later that she thought breakfasting in public a
barbarous practice.
After breakfast, the whole party, with the exception of Sir
Cheveley Drummond, went to church. Poor Sir Cheveley hardly saw
the point of going when he knew perfectly well that he would not be
permitted to share Lady Enid’s hymn-book.
I distinctly heard Lady Briardale say, as we were all waiting in the
hall:
“I should have thought, my dear, that he would have preferred a
synagogue.”
At church a thrill passed through me when I found that I was
seated next to Esther Lane. It was an infinite pleasure to me to be
sitting beside her through the long and stupid sermon. The yellow
winter sunlight fell across the recumbent effigies of dead and gone
Gascoynes, and made the painted window to the east a blaze of
colour.
Her presence and the surroundings filled me with a sense of
purity and peace, and I surrendered myself to the primitive
emotions. I suppose a less subtle soul would have been oppressed
with a sense of past sins, and would in such a building have been
filled with despair at the consciousness of irrevocable guilt. I
fortunately had schooled myself to control. The sensation of
goodness can, like other things, be acquired. When I had obtained
the prize for which I was striving I had not the least doubt that I
should find it easy to put away from me any unworthy feeling of
regret. Why should I not? The harm was after all very questionable.
It was not as if, so far, I had made widows and orphans. The amount
of suffering I had inflicted was limited, and at any rate I should not
leave poverty, the greatest of all ills, in my track. Indeed, under the
influence of that Sunday morning service I felt quite regenerated.
When we left the church Esther Lane and her pupil went through the
great gates of the castle into the woods beyond, and I would have
given worlds to follow her, but Lady Branksome told me that she
agreed with her son, and that I was decidedly amusing. She insisted
on my going for a walk with her. At the same time she took good
care to see that Mr. Puttock and Lady Enid were close behind.
In the afternoon I manœuvred a meeting with Esther Lane. I
surmised that she and her pupil would walk away from the castle,
and so I kept watch on the drawbridge. Everybody was more or less
occupied. I was aware that Lady Branksome had, before retiring for
her afternoon nap, left Mr. Puttock in possession of Lady Enid, who
had got rid of him with all the ease imaginable, and was now
walking with Sir Cheveley on the battlements.
Lord Gascoyne had pleaded letters, and I had arranged to fetch
him in an hour or so and go for a tramp.
As Esther Lane and her pupil crossed the drawbridge I was
leaning over the extreme end of the parapet in the most natural
manner in the world. I pretended not to notice them, and only
permitted myself to be aroused from a contemplation of the
beautiful scenery which lay below by the child flinging his arms with
a scream of delight round my legs.
She blushed as she apologised for her charge. She was evidently
a little nervous as to what her employers might think if they saw her
walking with one of their guests, and, after a short interchange of
commonplaces, tried to get rid of me. I refused to be shaken off,
and a couple of hundred yards took us out of sight of the castle.
We dropped at once into a style of conversation which was
almost intimate, and although I was with her barely three quarters
of an hour she confided a great deal in me.
Not that there was much to confide. She was the daughter of a
solicitor who had left nothing but debts. Her mother was dead, and
she was absolutely alone in the world. Her only relations were some
very distant cousins who were so poor that it had been impossible
for them to help her in any way.
“I was very lucky,” she said, gratefully, “to get such a good
situation, and it came about in the quaintest way. Lady Gascoyne
had seen all sorts of people with diplomas and recommendations
which I had not got, and she saw me sitting in the waiting-room as
she passed out. I don’t think the agent quite liked her engaging me,
but Lady Gascoyne insisted that I was just the person she wanted,
and here I am.”
She smiled contentedly. She evidently considered herself an
extremely fortunate young woman.
She attracted me enormously without in any way usurping the
place of the two women who already counted for so much in my life.
All too soon I was obliged to leave her and hurry back to Lord
Gascoyne, whom I found waiting for me.
It was the first opportunity I had had of really impressing him,
and I did not waste my time. I took such an absorbing interest in
everything about me that I fancy he was surprised to find himself
talking so much and so intimately.
I was perfectly ready to enter into the subjects which interested
him most. He was evidently deeply imbued with a belief in the divine
right of aristocracy, and with no superficial sense of its
responsibilities. He was above all things a serious man, with little
sense of humour. I imagined that Lady Gascoyne must find him dull,
but his qualities were essentially those which command women’s
respect and hold them with a certain kind of fear.
As is the case with his class—a class which the popular organs
are fond of describing as irresponsible and brainless—his knowledge
and grasp of life were very extensive. His individual sympathies may
not have been very great, but he had a general sense of justice
which marked him out as an administrator, from many who were
perhaps much his intellectual superiors. What he knew was of use to
him.
I was surprised at my own capacity for conciliating him. I
accompanied him with ease into the region of politics. He was
evidently impressed, and it was satisfactory to feel him gradually
treating me with less and less formality.
“Your race gave us one of our greatest statesmen,” he said, “for I
do not believe that anyone has understood real statesmanship better
than Disraeli.”
“Some people seem to think he was insincere,” I replied, “but I
don’t believe it. His cynicism was simply the complement of a mind
with a singularly large outlook.”
So subtle an appreciation impressed the man whose own nature
was all in a straight line. The curves of a less direct character
appealed to him as insight.
In listening to him, however, I could not help reflecting that his
kind, whatever the moralist may pretend, is far more vulgar than the
abnormal. The orchid is the most fascinating of flowers in all its
varieties, but it is rare; or do we only call that type normal which
prevails for the moment? Which is the more moral man—he who by
reason of a lack of imagination ranges himself as the mercenary of
tradition and convention, or he who rebels and finds himself
wounded and struck at wherever he turns? Not that I can claim to
be a martyr to moral restlessness, although at one time I sincerely
believe I had in me the makings of a reformer. Nevertheless, there is
always something a little vulgar about the man who ranges himself
definitely on one side.
We returned to the castle on very good terms indeed. The rest of
the party were at tea in the long picture-gallery. I like, even at this
unpleasant crisis, to linger over the memory of the picture-gallery at
Hammerton on that Sunday afternoon in midwinter. The long,
straight windows through which the frosty sunset flushed the gilded
frames and old tapestries, the firelight playing on the silver of the
tea-table drawn up before Lady Gascoyne—for there were no
servants to desecrate the most convivial of all meals—made up a
delightful picture, whilst the child Walter Chard, in his sailor clothes,
ran from one group to the other as happy and unconscious as if he
had a prescriptive right to the enchantment of the castle.
I was delighted on our assembling for dinner to find that Esther
Lane was of the party. She was dressed simply in gray, with a couple
of blush roses at her bosom. Lady Enid was talking to her when I
came in.
It fell to my lot to take her in to dinner, and we thoroughly
enjoyed ourselves. She was quite unconscious amongst these great
folk, and unaffectedly joyous. I almost fancied that Lady Gascoyne
looked at me once or twice with the faintest sign of surprise. I
sincerely hoped she would not inform Miss Lane of the fact that I
was engaged, although it was more than probable. Esther Lane was
one of those women who are, to a certain extent, lacking in the
natural defences of their sex as a result of their own honesty and
simplicity. That she was prepared to be interested in me was
obvious, and I made the most of my time. After dinner she played to
us. It was not a brilliant performance, but she was accurate and had
feeling, and she touched the keys wooingly and caressingly, making
the piano sing, a gift rare even among some so-called finished
performers. If people cannot make instruments sing they had better
leave them alone. Afterwards I played and sang, and she declared
herself ashamed of her own performance. Music had the advantage
of giving us an excuse for remaining at the piano together, and later,
when everybody else settled down to cards some way off, we were
left trying over one song after the other. When I murmured that it
seemed as if we had known each other all our lives she blushed.
Later, in the smoking-room, Sir Cheveley said he was quite
astonished to find how pretty she was. It was a fact which he
declared had grown on him gradually.
The next morning I returned to town, but I had made such good
use of my time that I carried with me an invitation to return in a
fortnight, and it was Lord Gascoyne who brought it me from his wife.
He had made quite a friend of me. It was not probable that he
had ever had a friend with anything of the bizarre about him before.
Chapter XXII
The time passed slowly, but in a fortnight I found myself again at
Hammerton sleeping beneath the same roof as Esther Lane. I met
her again on the terrace on Sunday morning, as I had expected. I
could quite follow the workings of her mind. Because she was
possessed of great self-respect, she had determined not to be on the
terrace that morning, but because she was very much in love she
was there after all. Before many moments had passed I saw that she
was aware of my engagement. There was a look of suffering in her
eyes as she turned them on me. She had the most wonderful way of
suddenly subjecting the person to whom she was speaking to their
full glance. If she could suffer because I was engaged to another
woman, she had enough sentimental interest in me to excuse my
going far. She was the character to appreciate the simulation of
agony born of a struggle between duty and affection, and I was
ready to ring up the curtain on the comedy. She was fully conscious
that I loved her. Yes, I loved her quite passionately, and yet it was
not altogether passion. It is one of the presumptuous platitudes of
conventional moralists to describe a man’s love when it ceases to be
concentrated on one individual as lust and base passion. Side by
side with this contention they will declare that the highest morality is
to love your neighbour as yourself, so little are they given to their
own boasted virtue of consistency.
I talked to her for some time about the most ordinary matters,
but I could see that she was trembling.
“I have thought of you a good deal,” I ventured.
She ignored the question, but without a show of indifference.
“I think Walter and I ought to go in.” She moved away a little
awkwardly.
“I suppose I ought to go in too.” I went to breakfast, leaving the
impression I had intended.
In the afternoon I saw her again, and before I was quite aware
of it, I had told her I loved her beyond all women in the world, and
having done so was compelled to anticipate the scene which I had
been mentally preparing.
I assured her passionately that I was not the fickle person I
might seem to be, that directly I saw her I knew that I had made a
mistake, and that I could never be happy with anyone but her.
She was too much in love to do more than make a pretence of
forbidding me to speak on the subject.
She walked straight into the carefully-hidden trap, and found
herself being made love to without the question of my engagement
being discussed, and once she had thrown down the barriers of
reserve, with the enemy actually in her camp, it was impossible to
replace them. She accused herself vehemently, however, of being
unworthy of her trust. She would resign her position. She could
never, she asserted, remain, and be guilty of duplicity. I beat down
her poor little attempts at self-defence at once. If she threw up such
a position I should never forgive myself. I would go away and never
see her again. The threat appeared to terrify her. I persisted that the
view of such affairs taken by most people was entirely wrong. I
showed that, on the contrary, it was wrong to lie and say you do not
love a person when you do, that it was quite possible to talk of our
love, to cherish it, and to welcome its influences for good, without
allowing it to get the upper hand. All of which the poor fluttering
little morsel of sentiment drank in with greedy ears, because it was
just what she wanted to believe.
The child found us dull, and cried out that he wanted to play, so I
left her and returned to keep an appointment with Lord Gascoyne.
Esther Lane was included in the dinner-party that evening, and I
again took her in. The arrangement was not so pleasant as on the
previous occasion, for there was a distinct feeling of strain between
us. I surmounted it with ease; but she was without experience, and
she suffered. I could see that she had been crying.
“You must not let yourself be wretched,” I said, as we stood a
little apart from the others waiting for the move towards the dining-
room. “It hurts me.”
“I had intended to remain in my room,” she murmured.
“Why?”
“I feel as if everyone must see that I am an impostor.”
I was about to reply lightly, but checked myself, remembering
that the heroine of the comedy was an ingénue.
“If you were not so good you would not have a sense of guilt
where there is no guilt.”
We went in to dinner.
I talked to her incessantly, and inasmuch as her happiness lay in
being with me, she was prepared to be charmed out of her misery
for however brief a period.
I was myself somewhat astonished at the hold I had secured
over her so soon. I suppose in her inmost heart she was dreaming
dreams in which all would come right. But even if I were safely
ensconced as Earl Gascoyne I could not have made such a sacrifice
as to marry her. Besides, in the sense of a mate, to take my name
and reign with me, I would not have changed Edith Gascoyne for
anyone in the world, not even for Sibella.
There is among modern English ballads one which has always
struck me as having a claim to live because of its simplicity and the
heart-throb in it. It is called ‘For ever and for ever.’ It possesses a
perfect blending of music and idea, unpretentious, but full of feeling.
As before, we spent the evening at the piano, and I sang this
song to her almost under my breath:
I could see that the tears were raining down her cheeks as she
listened. She held a fan so as to conceal her face from the others in
the room.
“We shall see each other again soon,” I murmured, as I said
good-night.
Lord Gascoyne and I were the last to leave the smoking-room,
and he parted from me at the foot of the stairs that led to the
bachelors’ quarters. My bedroom was half-way down a long corridor,
at the end of which there was a solid door, which gave on to the
battlements. It was bolted inside, but not locked, and I had more
than once used it to take an evening stroll when the inhabitants of
Hammerton Castle were asleep. This evening I opened the door
noiselessly and walked out on to the walls. It was a clear starlight
night and bitterly cold. I did not mind this, for I had on a thick fur
coat. I strolled along, thinking deeply, when suddenly I was brought
to a standstill by a ray of light that fell right across my path.
I looked in the direction from whence it came, and was
astonished to see Esther Lane leaning out of a window a few feet
from me. The terrace at this point took an abrupt turn, and a
comparatively new part of the castle had been built out at a tangent.
She had not noticed my approach, for I wore house-shoes, which
made no noise.
She was looking at the stars as if their ceaseless splendour might
be symbolic of an inevitable dawn of happiness somewhere. They
could not have been completely reassuring, for she was weeping,
and as I stood and watched, a convulsive sob broke from her. The
picture of the forlorn little dependent, a frail white figure in the
patch of light, with the gloomy towers and battlements of
Hammerton looming round her, affected me strangely. I leant
forward over the low wall and murmured her name.
“Esther!”
She started and looked round, drawing back quickly as she saw
me clearly defined in the moonlight.
“You must not cry. It breaks my heart.”
At the moment I fully believed what I said.
Her eyes, full of tears, were turned upon me, and, with a strange
look of fear, which haunts me to this hour, she said:
“I thought I should never see you again.”
“You were going away?”
She saw that she had betrayed her intention, and tried to excuse
herself.
“It will be better.”
“Why? If you go away I shall never come here again.”
I was upon the low wall, the ground full sixty feet below me.
“Oh, go back! you will fall.”
But I had my hand on her window-sill and one foot on a ledge a
short distance below it, whilst the other remained on the wall. She
was helpless; to have attempted to stay me would have been to
send me in all probability to certain death. She clasped her hands
and held her breath. The next moment I was in the room and by her
side.
“Don’t be afraid; only I must speak to you. We must understand
each other.”
“Oh, go away, please.”
She hid her face in her hands, utterly shamed by the presence of
a man in her room.
Poor Esther! I think she was happier. I verily believe that every
woman is happier for love fulfilled. I knew that once having chosen
her path she would follow it unflinchingly, and that she would be
true as steel. I had discerned from the first that she was capable of
martyrdom. From that day she never mentioned the word marriage.
She declared ever afterwards that it was her fault, that she should
have closed her window on me, that she had accepted the position
of mistress, and that she could not complain.
At the same time, however, it was no easy task to persuade her
to remain at Hammerton. She implored me to let her come away to
London. She vowed that she would not be an encumbrance, not
even an expense. She was sure that she could get work to do,
sufficient to keep herself; but I was firm. I had at one time some
idea of letting her live at Clapham in my deserted house, but I had
always had a superstition about allowing anyone else to live in it,
otherwise I should have sold it long before. Besides, I did not see
what excuse she was to give Lady Gascoyne for wishing to leave her,
and the latter had grown so fond of her that it was not likely she
would accept her resignation without a great deal of inquiry. Esther
declared that living a lie made her feel miserable, that she was
unworthy of her charge, and ought to resign it.
Chapter XXIII
I had still made no plans as regards Lord Gascoyne and his heir. I
must confess that I had qualms about the child, which shows how
illogical and unreasoning sentiment is. It is surely a greater crime to
kill a grown individual who has a place in the practical work of the
world, and who would be missed by hundreds, than to remove an
infant whose loss could only affect his parents. It was not easy for
me to inflict pain on a child, as my fondness for children is
exceptional. The means would have to be sudden and violent, and
they were difficult to think of. It might have been made to appear
that his death had been caused through some apparent negligence
of the nurse, had not the latter been a careful old lady through
whose hands two former generations of the Hammertons had
passed. I had, unperceived, followed her in her walks with the
Gascoyne heir, and I was afraid it would be impossible to find her
careless.
I was prepared to make away with father or child first; whichever
event came most readily to hand would have to take place. A novice
might have been impatient, but experience had taught me that one
had only to watch and wait, and the opportunity would come at the
most unexpected moment.
It was nearly time for Miss Gascoyne and her uncle and aunt to
return to town. I was wondering whether they would be asked down
with me to Hammerton. It would be somewhat awkward, but I had
infinite belief in my own powers of dissimulation and tact.
In the meantime I concentrated my thoughts on little Lord
Hammerton. I had read of a child being smothered by a cat going to
sleep over its mouth. For a time the somewhat impracticable idea
possessed me of obtaining a gutta-percha baby, which I would fill
with hot water and arrange so that it could breathe mechanically,
and then train a cat to lie upon it. The weirdness and humour of the
idea commended itself to me. The far-fetched nature of the scheme,
however, became more apparent the more I considered it.
I thought I might become a proficient with the catapult, and aim
at the child unseen. In such a case the blame would probably fall on
a village boy. This, too, seemed rather far-fetched.
I had seen Hammerton’s nursery, or rather nurseries. Even a
child of his rank seldom has such a suite of apartments:—a night
and day nursery of lofty proportions, with rooms for the head-nurse
and her assistant opening off. It was the size and loftiness of the
rooms that were exceptional. Lady Gascoyne was a great enthusiast
on hygiene, and declared that fresh air was the best food a child
could have. In fact, I was not likely to be spared my unpleasant task
through any neglect of the little Viscount’s health.
My objection to inflicting pain upon a child gradually grew
weaker. Something had to be done.
I was seriously considering the matter when Providence put a
weapon into my hand.
I arrived one Saturday evening to find Lady Gascoyne somewhat
uneasy. Walter Chard was not well. Something quite trifling, no
doubt, but he was feverish.
I asked if I might go and see him, but Lady Gascoyne said that
she would rather I did not. It was always difficult to say how these
childish ailments would develop. It might be something infectious,
and she had Hammerton to think of. If anything happened to him
Lord Gascoyne would be broken-hearted.
“Miss Lane is with him,” went on Lady Gascoyne. “She absolutely
declines to allow anyone else to nurse him.”
I wondered whether Esther Lane had known that her undertaking
to nurse the child would prevent her from seeing me. For the
moment I was a little annoyed, as even the most supercilious man
will be when he imagines the woman he is thinking of very much at
the moment has found a duty which she places above her love.