100% found this document useful (9 votes)
47 views

Instant Download Data Structures and the Java Collections Frameworks 3rd Edition William J. Collins PDF All Chapters

Java

Uploaded by

dolfikeets3z
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (9 votes)
47 views

Instant Download Data Structures and the Java Collections Frameworks 3rd Edition William J. Collins PDF All Chapters

Java

Uploaded by

dolfikeets3z
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

Download the full version of the ebook at ebookname.

com

Data Structures and the Java Collections


Frameworks 3rd Edition William J. Collins

https://ebookname.com/product/data-structures-and-the-java-
collections-frameworks-3rd-edition-william-j-collins/

OR CLICK BUTTON

DOWNLOAD EBOOK

Download more ebook instantly today at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Object Oriented Data Structures Using Java Chip Weems

https://ebookname.com/product/object-oriented-data-structures-using-
java-chip-weems/

ebookname.com

Data Structures and Abstractions with Java 4th Edition


Frank M. Carrano

https://ebookname.com/product/data-structures-and-abstractions-with-
java-4th-edition-frank-m-carrano/

ebookname.com

Java Methods A Ab Object oriented Programming and Data


Structures Maria Litvin

https://ebookname.com/product/java-methods-a-ab-object-oriented-
programming-and-data-structures-maria-litvin/

ebookname.com

Rare Association Rule Mining and Knowledge Discovery


Technologies for Infrequent and Critical Event Detection
Advances in Data Warehousing and Mining Adwm Book 1st
Edition Yun Sing Koh
https://ebookname.com/product/rare-association-rule-mining-and-
knowledge-discovery-technologies-for-infrequent-and-critical-event-
detection-advances-in-data-warehousing-and-mining-adwm-book-1st-
edition-yun-sing-koh/
ebookname.com
10 Minute Guide to Pocket PC 2002 1st Edition Michael
Miller

https://ebookname.com/product/10-minute-guide-to-pocket-pc-2002-1st-
edition-michael-miller/

ebookname.com

The behavioral foundations of public policy 7th Edition


Shafir

https://ebookname.com/product/the-behavioral-foundations-of-public-
policy-7th-edition-shafir/

ebookname.com

The Living Gut Second Edition W. N. Ewing

https://ebookname.com/product/the-living-gut-second-edition-w-n-ewing/

ebookname.com

Top 10 Paris Eyewitness Top 10 Travel Guides 1 Pap/Map


Edition Mike Gerrard

https://ebookname.com/product/top-10-paris-eyewitness-top-10-travel-
guides-1-pap-map-edition-mike-gerrard/

ebookname.com

How Do You Hug a Cactus Reflective Parenting with


Teenagers in Mind 1st Edition Sheila Redfern

https://ebookname.com/product/how-do-you-hug-a-cactus-reflective-
parenting-with-teenagers-in-mind-1st-edition-sheila-redfern/

ebookname.com
Lessons from a Quechua Strongwoman Ideophony Dialogue and
Perspective 1st Edition Janis B. Nuckolls

https://ebookname.com/product/lessons-from-a-quechua-strongwoman-
ideophony-dialogue-and-perspective-1st-edition-janis-b-nuckolls/

ebookname.com
This page intentionally left blank
Data Structures and the
Java Collections Framework
This page intentionally left blank
Data Structures and the
Java Collections Framework

Third Edition

William J. Collins
Lafayette College

JOHN WILEY & SONS, INC.


Vice President and Executive Publisher: Donald Fowley
Executive Editor: Beth Lang Golub
Editorial Assistants: Michael Berlin, Elizabeth Mills
Marketing Manager: Chris Ruel
Senior Production Manager: Janis Soo
Assistant Production Editor: Annabelle Ang-Bok
Designers: Seng Ping Ngieng
Cover Photo: © Jose Ignacio Soto/iStockphoto

This book was set in 10/12 Times Roman by Laserwords and printed and bound by Malloy Lithographers. The cover was printed by Malloy
Lithographers.

This book is printed on acid free paper.

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.

Copyright © 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,
website www.copyright.com. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley &
Sons, Inc., 111 River Street, Hoboken, NJ 07030-5774, (201)748–6011, fax (201)748–6008, website http://www.wiley.com/go/permissions.

Evaluation copies are provided to qualified academics and professionals for review purposes only, for use in their courses during the next
academic year. These copies are licensed and may not be sold or transferred to a third party. Upon completion of the review period, please
return the evaluation copy to Wiley. Return instructions and a free of charge return shipping label are available at www.wiley.com/go/
returnlabel. Outside of the United States, please contact your local representative.

Library of Congress Cataloging-in-Publication Data

Collins, William J. (William Joseph)


Data structures and the Java collections framework / William Collins. – 3rd ed.
p. cm.
Includes bibliographical references and index.
ISBN 978-0-470-48267-4 (paperback)
1. Java (Computer program language) 2. Data structures (Computer science) I. Title.
QA76.73.J38C657 2011
005.7 3–dc22
2010043311
Printed in the United States of America
10 9 8 7 6 5 4 3 2 1
To Jayden—my fountain of youth

—W.J.C.
This page intentionally left blank
BRIEF CONTENTS

Preface xvii

CHAPTER 0
Introduction to Java 1

CHAPTER 1
Object-Oriented Concepts 27

CHAPTER 2
Additional Features of Programming and Java 59

CHAPTER 3
Analysis of Algorithms 105

CHAPTER 4
The Java Collections Framework 133

CHAPTER 5
Recursion 155

CHAPTER 6
Array-Based Lists 233

CHAPTER 7
Linked Lists 267

CHAPTER 8
Stacks and Queues 329

vii
viii BRIEF CONTENTS

CHAPTER 9
Binary Trees 377

CHAPTER 10
Binary Search Trees 401

CHAPTER 11
Sorting 457

CHAPTER 12
Tree Maps and Tree Sets 501

CHAPTER 13
Priority Queues 551

CHAPTER 14
Hashing 599

CHAPTER 15
Graphs, Trees, and Networks 643

APPENDIX 1
Additional Features of the JAVA Collections Framework 701

APPENDIX 2
Mathematical Background 705

APPENDIX 3
Choosing a Data Structure 721

References 725

Index 727
CONTENTS

Preface xvii 1.3 Inheritance 37


1.3.1 The protected Visibility
Modifier 39
CHAPTER 0 1.3.2 Inheritance and Constructors 43
Introduction to Java 1 1.3.3 The Subclass Substitution Rule 43
1.3.4 Is-a versus Has-a 47
Chapter Objectives 1
1.4 Information Hiding 48
0.1 Java Fundamentals 1
1.5 Polymorphism 48
0.1.1 Primitive Types 2
1.6 The Unified Modeling Language 49
0.1.2 The char Type 2
Summary 52
0.2 Classes 3
0.2.1 The String Class 4 Crossword Puzzle 54
0.2.2 Using javadoc Notation for Method Concept Exercises 55
Specifications 5 Programming Exercises 56
0.2.3 Equality of References and Equality of Programming Project 1.1: A CalendarDate
Objects 7 Class 58
0.2.4 Local Variables 9
0.2.5 The Scanner Class 12
0.3 Arrays 17
CHAPTER 2
Additional Features of Programming
0.4 Arguments and Parameters 19 and Java 59
0.5 Output Formatting 22
Chapter Objectives 59
Crossword Puzzle 24
2.1 Static Variables, Constants and Methods 59
Programming Exercises 25
2.2 Method Testing 61
2.2.1 More Details on Unit Testing 64

CHAPTER 1 2.3 Exception Handling 68


2.3.1 Propagating Exceptions 71
Object-Oriented Concepts 27 2.3.2 Unit Testing and Propagated
Exceptions 74
Chapter Objectives 27
2.3.3 Checked Exceptions 77
1.1 Data Abstraction 27 2.3.4 The finally Block 81
1.2 Abstract Methods and Interfaces 28 2.4 File Output 81
1.2.1 Abstract Data Types and Data
2.5 System Testing 91
Structures 31
1.2.2 An Interface and a Class that 2.6 The Java Virtual Machine 92
Implements the Interface 31 2.6.1 Pre-Initialization of Fields 92
1.2.3 Using the FullTimeEmployee 2.6.2 Garbage Collection 92
Class 35 2.7 Packages 93

ix
x CONTENTS

2.8 Overriding the Object Class’s equals 4.2 Some Details of the Java Collections
Method 94 Framework 136
Summary 97 4.2.1 Abstract Classes 137
4.2.2 Parameterized Types 140
Crossword Puzzle 98
4.2.3 The Collection Interface 141
Concept Exercises 99 4.2.4 The List Interface 147
Programming Exercises 100 Summary 150
Programming Project 2.1: An Integrated Web Crossword Puzzle 151
Browser and Search Engine, Part 1 102
Concept Exercises 152
Programming Exercises 152
CHAPTER 3 Programming Project 4.1: Wear a Developer’s Hat
and a User’s Hat 153
Analysis of Algorithms 105
Chapter Objectives 105
3.1 Estimating the Efficiency of Methods 105
3.1.1 Big-O Notation 106
CHAPTER 5
3.1.2 Getting Big-O Estimates Quickly 110
Recursion 155
3.1.3 Big-Omega, Big-Theta and Plain Chapter Objectives 155
English 116 5.1 Introduction 155
3.1.4 Growth Rates 117
5.2 Factorials 156
3.1.5 Trade-Offs 119
5.2.1 Execution Frames 159
3.2 Run-Time Analysis 121
5.3 Decimal to Binary 162
3.2.1 Timing 121
3.2.2 Overview of the Random Class 122 5.4 Towers of Hanoi 167
5.4.1 Analysis of the move Method 177
Summary 126
5.5 Searching an Array 179
Crossword Puzzle 127
5.6 Backtracking 191
Concept Exercises 128
5.6.1 An A-maze-ing Application 195
Programming Exercises 130
5.7 Indirect Recursion 208
Programming Project 3.1: Let’s Make a
5.8 The Cost of Recursion 209
Deal! 131
Summary 210
Crossword Puzzle 211
CHAPTER 4 Concept Exercises 212
Programming Exercises 214
The Java Collections
Framework 133 Programming Project 5.1: Iterative Version of the
Towers of Hanoi 219
Chapter Objectives 133
Programming Project 5.2: Eight Queens 221
4.1 Collections 133
Programming Project 5.3: A Knight’s Tour 222
4.1.1 Collection Classes 134
4.1.2 Storage Structures for Collection Programming Project 5.4: Sudoku 225
Classes 136 Programming Project 5.5: Numbrix 227
CONTENTS xi

CHAPTER 6 7.3 Doubly-Linked Lists 281


7.3.1 A User’s View of the LinkedList
Array-Based Lists 233 Class 282
7.3.2 The LinkedList Class versus the
Chapter Objectives 233 ArrayList Class 282
6.1 The List Interface 234 7.3.3 LinkedList Iterators 285
6.2 The ArrayList Class 234 7.3.4 A Simple Program that uses a
6.2.1 Method Specifications for the LinkedList Object 291
ArrayList Class 235 7.3.5 Fields and Heading of the
6.2.2 A Simple Program with an LinkedList Class 294
ArrayList Object 244 7.3.6 Creating and Maintaining a
6.2.3 The ArrayList Class’s Heading and LinkedList Object 296
Fields 246 7.3.7 Definition of the Two-Parameter add
6.2.4 Definition of the One-Parameter add Method 298
Method 248 7.4 Application: A Line Editor 300
6.3 Application: High-Precision Arithmetic 251 7.4.1 Design and Testing of the Editor
6.3.1 Method Specifications and Testing of Class 304
the VeryLongInt Class 252 7.4.2 Method Definitions for the Editor
6.3.2 Fields in the VeryLongInt Class 308
Class 253 7.4.3 Analysis of the Editor Class
6.3.3 Method Definitions of the Methods 312
VeryLongInt Class 254 7.4.4 Design of the EditorUser
Summary 257 Class 312
Crossword Puzzle 258 7.4.5 Implementation of the EditorUser
Concept Exercises 259 Class 313
Programming Exercises 259 Summary 315
Programming Project 6.1: Expanding the Crossword Puzzle 316
VeryLongInt Class 263 Concept Exercises 317
Programming Project 6.2: An Integrated Web Programming Exercises 318
Browser and Search Engine, Part 2 264 Programming Project 7.1: Expanding the
SinglyLinkedList Class 320
Programming Project 7.2: Implementing the
CHAPTER 7 remove() Method in
SinglyLinkedListIterator 322
Linked Lists 267
Programming Project 7.3: Making a Circular
Chapter Objectives 267 Singly Linked List Class 322
7.1 What is a Linked List? 267 Programming Project 7.4: Alternative
7.2 The SinglyLinkedList Class—A Implementation of the LinkedList
Singly-Linked, Toy Class! 268 Class 323
7.2.1 Fields and Method Definitions in the Programming Project 7.5: Expanding the Line
SinglyLinkedList Class 273 Editor 323
7.2.2 Iterating through a Programming Project 7.6: An Integrated Web
SinglyLinkedList Object 276 Browser and Search Engine, Part 3 328
xii CONTENTS

CHAPTER 8 9.4 External Path Length 385


9.5 Traversals of a Binary Tree 386
Stacks and Queues 329 Summary 393
Chapter Objectives 329 Crossword Puzzle 394
8.1 Stacks 329 Concept Exercises 395
8.1.1 The Stack Class 329
8.1.2 A Fatal Flaw? 333
8.1.3 Stack Application 1: How Compilers
Implement Recursion 334
CHAPTER 10
Binary Search Trees 401
8.1.4 Stack Application 2: Converting from
Infix to Postfix 338 Chapter Objectives 401
8.1.5 Prefix Notation 343 10.1 Binary Search Trees 402
8.2 Queues 347 10.1.1 The BinarySearchTree
8.2.1 The Queue Interface 348 Implementation of the Set
8.2.2 Implementations of the Queue Interface 403
Interface 349 10.1.2 Implementation of the
8.2.3 Computer Simulation 350 BinarySearchTree Class 411
8.2.4 Queue Application: A Simulated Car 10.2 Balanced Binary Search Trees 430
Wash 351 10.2.1 AVL Trees 435
Summary 365 10.2.2 The Height of an AVL Tree 436
10.2.3 The AVLTree Class 438
Crossword Puzzle 366 10.2.4 Runtime Estimates 441
Concept Exercises 367 Summary 442
Programming Exercises 368 Crossword Puzzle 443
Programming Project 8.1: Making the Speedo’s Concept Exercises 444
Car Wash Simulation More Realistic 369
Programming Exercises 448
Programming Project 8.2: Design, Test, and
Programming Project 10.1: An Alternate
Implement a Program to Evaluate a
Implementation of the Binary-Search-Tree
Condition 371
Data Type 449
Programming Project 8.3: Maze-Searching,
Programming Project 10.2: Printing a
Revisited 374
BinarySearchTree Object 451
Programming Project 8.4: Fixing the Stack
Programming Project 10.3: The
Class 375
fixAfterInsertion Method 451
Programming Project 10.4: The
fixAfterDeletion Method 455

CHAPTER 9
Binary Trees 377
Chapter Objectives 377
CHAPTER 11
Sorting 457
9.1 Definition of Binary Tree 377
9.2 Properties of Binary Trees 378 Chapter Objectives 457
9.3 The Binary Tree Theorem 383 11.1 Introduction 457
CONTENTS xiii

11.2 Simple Sorts 458 12.5 The TreeSet Class 525


11.2.1 Insertion Sort 459 12.5.1 Implementation of the TreeSet
11.2.2 Selection Sort 461 Class 528
11.2.3 Bubble Sort 463 12.5.2 Application: A Simple Spell
11.3 The Comparator Interface 465 Checker 530
11.4 How Fast Can we Sort? 468 Summary 536
11.4.1 Merge Sort 470 Crossword Puzzle 537
11.4.2 The Divide-and-Conquer Design Concept Exercises 538
Pattern 476
Programming Exercises 539
11.4.3 Quick Sort 477
Programming Project 12.1: Spell Check,
11.5 Radix Sort 489
Revisited 540
Summary 493
Programming Project 12.2: Word
Crossword Puzzle 494 Frequencies 542
Concept Exercises 495 Programming Project 12.3: Building a
Programming Exercises 497 Concordance 543
Programming Project 11.1: Sorting a File into Programming Project 12.4: Approval Voting 545
Ascending Order 497 Programming Project 12.5: An Integrated Web
Browser and Search Engine, Part 4 548

CHAPTER 12
Tree Maps and Tree Sets 501 CHAPTER 13
Priority Queues 551
Chapter Objectives 501
12.1 Red-Black Trees 501 Chapter Objectives 551
12.1.1 The Height of a Red Black 13.1 Introduction 551
Tree 503 13.2 The PriorityQueue Class 552
12.2 The Map Interface 504 13.3 Implementation Details of the
12.3 The TreeMap Implementation of the PriorityQueue Class 553
SortedMap Interface 509 13.3.1 Fields and Method Definitions in
12.3.1 The TreeMap Class’s Fields and the PriorityQueue Class 557
Embedded Entry Class 512 13.4 The heapSort Method 567
12.3.2 Method Definitions in the TreeMap 13.4.1 Analysis of heapSort 572
Class 513 13.5 Application: Huffman Codes 573
12.4 Application of the TreeMap Class: a Simple 13.5.1 Huffman Trees 575
Thesaurus 517 13.5.2 Greedy Algorithm Design
12.4.1 Design, Testing, and Implementation Pattern 578
of the Thesaurus Class 518 13.5.3 The Huffman Encoding
12.4.2 Design and Testing of the Project 578
ThesaurusUser Class 521 Summary 590
12.4.3 Implementation of the Crossword Puzzle 591
ThesaurusUser Class 523 Concept Exercises 592
xiv CONTENTS

Programming Exercises 594 Programming Project 14.2: An Integrated Web


Browser and Search Engine, Part 6 640
Programming Project 13.1: Decoding a
Huffman-Encoded Message 595
Programming Project 13.2: An Integrated Web
Browser and Search Engine, Part 5 597 CHAPTER 15
Graphs, Trees, and Networks 643
Chapter Objectives 643
CHAPTER 14 15.1 Undirected Graphs 643
Hashing 599 15.2 Directed Graphs 647
Chapter Objectives 599 15.3 Trees 648
14.1 A Framework to Analyze Searching 599 15.4 Networks 649
14.2 Review of Searching 600 15.5 Graph Algorithms 650
14.2.1 Sequential Search 600 15.5.1 Iterators 650
14.2.2 Binary Search 601 15.5.2 Connectedness 658
14.2.3 Red-Black-Tree Search 602 15.5.3 Generating a Minimum Spanning
14.3 The HashMap Implementation of the Map Tree 659
Interface 603 15.5.4 Finding the Shortest Path through a
Network 663
14.3.1 Hashing 604
15.5.5 Finding the Longest Path through a
14.3.2 The Uniform Hashing
Network? 667
Assumption 609
14.3.3 Chaining 609 15.6 A Network Class 669
14.3.4 Implementation of the HashMap 15.6.1 Method Specifications and Testing
Class 612 of the Network Class 671
14.3.5 Analysis of the containsKey 15.6.2 Fields in the Network Class 680
Method 614 15.6.3 Method Definitions in the Network
14.3.6 The HashIterator Class 615 Class 681
14.3.7 Creating a Symbol Table by 15.7 Backtracking Through A Network 686
Hashing 617 Summary 689
14.4 The HashSet Class 625 Crossword Puzzle 690
14.5 Open-Address Hashing (optional) 626 Concept Exercises 691
14.5.1 The remove Method 627 Programming Exercises 693
14.5.2 Primary Clustering 631 Programming Project 15.1: The Traveling
14.5.3 Double Hashing 632 Salesperson Problem 694
Summary 635 Programming Project 15.2: Backtracking through a
Crossword Puzzle 636 Network 695
Concept Exercises 637 Programming Project 15.3: Determining Critical
Programming Exercises 639 Activities in a Project Network 697
Programming Project 14.1: The Double Hashing Programming Project 15.4: An Integrated Web
Implementation of the HashMap Class 640 Browser and Search Engine, Part 7 698
CONTENTS xv

APPENDIX 1 APPENDIX 3
Additional Features of the JAVA Choosing a Data Structure 721
Collections Framework 701
A3.1 Introduction 721
A1.1 Introduction 701 A3.2 Time-Based Ordering 721
A1.2 Serialization 701 A3.3 Index-Based Ordering 721
A1.3 Fail-Fast Iterators 703 A3.4 Comparison-Based Ordering 722
A3.5 Hash-Based Ordering 723
A3.6 Space Considerations 723
APPENDIX 2 A3.7 The Best Data Structure? 724
Mathematical Background 705
A2.1 Introduction 705
References 725
A2.2 Functions and Sequences 705
A2.3 Sums and Products 706 Index 727
A2.4 Logarithms 707
A2.5 Mathematical Induction 708
A2.6 Induction and Recursion 719
Concept Exercises 719
This page intentionally left blank
PREFACE

This book is intended for an object-oriented course in data structures and algorithms. The implementation
language is Java, and it is assumed that students have taken a first course in programming, not necessarily
in Java. That course should have covered the fundamental statements and data types, as well as arrays.
Chapter 0 supplies the material on Java that is fundamental to the remaining chapters, so it serves as a
review for those with previous experience in Java, and brings Java novices up to speed.

WHAT’S NEW IN THE THIRD EDITION


This edition presents two major changes from the second edition. First, the Scanner class has replaced
the BufferedReader and StringTokenizer classes. The Scanner class’s versatility supports pattern
matching as well as keyboard input and file input. Second, there is an increased emphasis on testing. In
particular, the unit-testing features of JUnit 4 are introduced in Chapter 2 and integrated in applications
throughout the remaining chapters.

THE JAVA COLLECTIONS FRAMEWORK


One of the distinctive features of this text is its emphasis on the Java Collections Framework, part of
the java.util package. Basically, the framework is a hierarchy with interfaces at each level except the
lowest, and collection classes that implement those interfaces at the lowest level. The collection classes
implement most of the data structures studied in a second computer-science course, such as a resizable array
class, a linked-list class, a stack class, a queue class, a balanced binary-search-tree class, a priority-queue
class, and a hash-map class.
There are several advantages to using the Java Collections Framework. First, students will be working
with code that has been extensively tested; they need not depend on modules created by the instructor or
textbook author. Second, the framework is available for later courses in the curriculum and beyond. Third,
although the primary emphasis is on using the Java Collections Framework, the framework classes are not
treated simply as “black boxes.” For each such class, the heading and fields are provided, and one method
definition is dissected. This exposition takes away some of the mystery that would otherwise surround the
class, and allows students to see the efficiency and succinctness of professionals’ code.
The version of the Java Collections Framework we will be working with includes type parameters.
Type parameters, sometimes called “generic types,” “generics,” or “templates,” were added to the Java
language starting with Java 5.0. With type parameters, there is no need to downcast the return value from
a collection, and many errors can be detected at compile-time that previously were discoverable only at
run-time.
To complement generics, three other features have been added: boxing, unboxing, and an enhanced
for statement. The elements in generic collections must be objects, often from a wrapper class such as
Integer. If a primitive value appears where a collection method requires a wrapper element as an argu-
ment, boxing automatically converts the primitive value to the corresponding wrapper element. Conversely,
xvii
xviii PREFACE

if a wrapper-class element appears where a primitive value is needed, unboxing automatically converts
that element to the corresponding primitive value. Finally, the enhanced for statement—often called a
“for-each” statement—has a sleek structure for iterating through a collection. The net effect of these new
features of Java is to improve productivity by relegating to the compiler many of the “boiler-plate” details
related to casting and iterating.

OTHER IMPLEMENTATIONS CONSIDERED


As important as the Java Collections Framework implementations are, they cannot be the exclusive focus
of such a fundamental course in data structures and algorithms. Approaches that differ from those in the
framework deserve consideration. For example, the HashMap class utilizes chaining, so there is a separate
section on open addressing, and a discussion of the trade-offs of one design over the other. Also, there is
coverage of data structures (such as a weighted digraph class) and algorithms (such as Heap Sort) that are
not yet included in the Java Collections Framework.
Sometimes, the complexity of the framework classes is mitigated by first introducing simpler
versions of those classes. For example, the SinglyLinkedList class—not in the Java Collections
Framework—helps to pave the way for the more powerful LinkedList class, which is in the framework.
And the BinarySearchTree class prepares students to understand the framework’s TreeMap class,
based on red-black trees.
This text satisfies another important goal of a data structures and algorithms course: Students have the
opportunity to develop their own data structures. There are programming projects in which data structures
are either created “from the ground up” or extended from examples in the chapters. And there are many
other projects to develop or extend applications that use the Java Collections Framework.

JUNIT AND TEST-FIRST DEVELOPMENT


Students realize that methods with no compile-time errors may still be a long way from correct, but they
often need help in learning how to systematically test their methods. As described in Chapter 2, JUnit is
an Open Source platform for the testing of units, that is, methods. For example, to test a findMedian
method, a FindMedianTest class is developed. The FindMedianTest class consists mainly of methods
that test findMedian. When all the test methods in FindMedianTest have been passed, the student’s
confidence in the correctness of findMedian is increased.
Instead of writing the tests after a method has been defined, we employ a “test-first” strategy. As
soon as a method’s specifications have been written, the tests for that method are coded. This ensures
that the tests are based on the specifications only, not on the definition of the method. These tests are run
on a “stub” version of the method to be tested, and all of the tests will fail. Then the method definition
is written, and the tests are run on that version of the method. Corrections to the method are made as
necessary until, eventually, all tests succeed. The test-first paradigm is introduced in Chapter 2 and utilized
in subsequent chapters.

PEDAGOGICAL FEATURES
This text offers several features that may improve the teaching environment for instructors and the learning
environment for students. Each chapter starts with a list of objectives, and most chapters conclude with
several major programming assignments. Each chapter also has a crossword puzzle, from Crossword
PREFACE xix

Weaver—to help students learn the key words and phrases in an enjoyable setting—and a variety of
exercises. The answers to all of the exercises are available to the instructor.
Each data structure is carefully described, with the specifications for each method given in javadoc
notation. Also, there are examples of how to call the method, and the results of that call. To reinforce
the important aspects of the material and to hone students’ coding skills in preparation for programming
projects, there is a suite of 23 lab experiments. The organization of these labs is described later in this
preface.

SUPPORT MATERIAL
The website for all of the support material is www.wiley.com/college/collins/
That website has links to the following information for students:
• The suite of 23 labs. Lab 0 starts with a brief overview of the lab format.
• The source codes for all classes developed in the text.
• Applets for projects that have a strong visual component.
Additionally, instructors can obtain the following from the website:
• PowerPoint slides for each chapter (approximately 1500 slides).
• Answers to every exercise and lab experiment.

SYNOPSES OF THE CHAPTERS


Chapter 0 serves as an introduction to the Java language for those whose first course was in some other
language. For students who are already familiar with Java, the chapter consists mostly of review material,
but the treatment of the Scanner class is worth perusing.
Chapter 1 focuses on the fundamentals of object-oriented programming: encapsulation, inheritance
and polymorphism. For a concrete illustration of these topics, an interface is created and implemented, and
the implementation is extended. The relationship between abstract data types and interfaces is explored, as
is the corresponding connection between data structures and classes. The Universal Modeling Language
provides a design tool to depict the interrelationships among interfaces, classes and subclasses.
Chapter 2 introduces unit testing with the free package JUnit. This is a vital topic in programming,
so method testing—before the method is defined—is emphasized in virtually all subsequent applications,
programming assignments and lab experiments. The chapter also includes some additional features of the
Java language. For example, there are sections on exception handling, file output, and the Java Virtual
Machine. Also, there is a section on the Object class’s equals method, why that method should be
overridden, and how to accomplish the overriding.
Finally, Chapter 2 introduces a “theme” project: to develop an integrated web browser and search
engine. This project, based on a paper by Newhall and Meeden [2002], continues through six of the
remaining chapters, and clearly illustrates the practical value of understanding data structures. In the first
part of the project, students develop a graphical user interface—a version of this interface is available
to instructors who prefer to provide this part of the project to students. The remaining six parts involve
an ArrayList object, a LinkedList object, a TreeMap object, a PriorityQueue object, a HashMap
object, and a Digraph object.
xx PREFACE

Chapter 3, Analysis of Algorithms, starts by defining functions to estimate a method’s execution-time


requirements, both in the average and worst cases. Big-O notation provides a convenient tool for estimating
these estimates. Because Big-O notation yields environment-independent estimates, these results are then
compared with actual run-times, which are determined with the help of the Random class and the nanoTime
method.
Chapter 4 outlines the Java Collections Framework. We start with some preliminary material
on collection classes in general, type parameters and the iterator design-pattern. The remainder of the
chapter presents part of the major interface hierarchy (Collection and List) and its implementations
(ArrayList and LinkedList).
Chapter 5, on recursion, represents a temporary shift in emphasis from data structures to algorithms.
There is a gradual progression from simple examples (factorial and decimal-to-binary) to more powerful
examples (binary search and backtracking). The mechanism for illustrating the execution of recursive
methods is the execution frame. Backtracking is introduced, not only as a design pattern, but as another
illustration of creating polymorphic references through interfaces. And the same BackTrack class is used
for maze-searching and solving eight queens, knight’s tour, Sudoku, and Numbrix.
In Chapter 6, we study the Java Collections Framework’s ArrayList class. An ArrayList object
is a smart array: automatically resizable, and with methods to handle insertions and deletions at any
index. The design starts with the method specifications for some of the most widely-used methods in the
ArrayList class. There follows a brief outline of the implementation of the class. The application of the
ArrayList class, high-precision arithmetic, is essential for public-key cryptography. This application is
extended in a lab and in a programming project. Several JUnit 4 tests are included in the chapter, and the
remaining tests are available from the book’s website.
Chapter 7 presents linked lists. A discussion of singly-linked lists leads to the development of a prim-
itive SinglyLinkedList class. This serves mainly to prepare students for the framework’s LinkedList
class. LinkedList objects are characterized by linear-time methods for inserting, removing or retrieving
at an arbitrary position. This property makes a compelling case for list iterators: objects that traverse a
LinkedList object and have constant-time methods for inserting, removing or retrieving at the “current”
position. The framework’s design is doubly-linked and circular, but other approaches are also considered.
The application is a small line-editor, for which list iterators are well suited. Testing entails an interesting
feature: the testing of protected methods. The line-editor application is extended in a programming project.
Stacks and queues are the subjects of Chapter 8. The framework’s Stack class has the expected push,
pop, and peek methods. But the Stack class also allows elements to be inserted or removed anywhere
in a Stack object, and this permission violates the definition. Students can use the Stack class—with
care—or develop their own version that satisfies the definition of a stack. There are two applications of
stacks: the implementation of recursion by a compiler, and the conversion from infix to postfix. This latter
application is expanded in a lab, and forms the basis for a project on evaluating a condition.
The Java Collections Framework has a Queue interface, but that interface supports the removal of
any element from a queue! As with the Stack class, students can tolerate this flaw and use a class—such
as LinkedList —that implements the Queue interface. Or they can create their own implementation
that does not violate the definition of a queue. The specific application of queues, calculating the average
waiting time at a car wash, falls into the general category of computer simulation.
Chapter 9 focuses on binary trees in general, as a prelude to the material in Chapters 10 through
13. The essential features of binary trees are presented, including both botanical (root, branch, leaf) and
familial (parent, child, sibling) terms. Binary trees are important for understanding later material on AVL
trees, decision trees, red-black trees, heaps, and Huffman trees.
PREFACE xxi

In Chapter 10, we look at binary search trees, including a BinarySearchTree class, and explain the
value of balanced binary search trees. Rotations are introduced as the mechanism by which re-balancing
is accomplished, and AVL trees are offered as examples of balanced binary search trees. An AVLTree
class, as a subclass of BinarySearchTree, is outlined; the crucial methods, fixAfterInsertion and
fixAfterDeletion, are left as programming projects.
Sorting is the theme of Chapter 11. Estimates of the lower bounds for comparison-based sorts are
determined. A few simple sorts are defined, and then we move on to two sort methods provided by the
framework. Quick Sort sorts an array of a primitive type, and Merge Sort works for an array of objects
and for implementations of the List interface. A lab experiment compares all of these sort algorithms on
randomly-generated integers.
The central topic of Chapter 12 is how to use the TreeMap class. A map is a collection in which
each element has a unique key part and also a value part. In the TreeMap implementation of the Map
interface, the elements are stored in a red-black tree, ordered by the elements’ keys. There are labs to
guide students through the details of re-structuring after an insertion or removal. The application consists
of searching a thesaurus for synonyms, and JUnit 4 testing is again illustrated. The TreeSet class has a
TreeMap field in which each element has the same, dummy value-part. The application of the TreeSet
class is a simple spell-checker, which is also thoroughly tested.
Chapter 13 introduces the PriorityQueue class. This class is part of the Java Collections Frame-
work and, like the Stack class and Queue interface in Chapter 8, allows methods that violate the definition
of a priority queue. The class utilizes a heap to provide insertions in constant average time, and removal of
the smallest-valued element in logarithmic worst time. The application is in the area of data compression:
Given a text file, generate a minimal, prefix-free encoding. There is a project assignment to convert the
encoded message back to the original text file.
Chapter 14 investigates hashing. The Java Collections Framework has a HashMap class for elements
that consist of unique-key/value pairs. Basically, the average time for insertion, removal, and searching is
constant! This average speed is exploited in an application (and JUnit 4 tests) to create a simple symbol
table. The Java Collections Framework’s implementation of hashing, using chained hashing, is compared
to open-address hashing.
The most general data structures—graphs, trees, and networks—are presented in Chapter 15. There
are outlines of the essential algorithms: breadth-first traversal, depth-first traversal, finding a minimum
spanning tree, and finding the shortest or longest path between two vertices. The only class developed
is the (directed) Network class, with an adjacency-map implementation. Other classes, such as Undi
rectedGraph and UndirectedNetwork, can be straightforwardly defined as subclasses of Network.
The Traveling Salesperson Problem is investigated in a lab, and there is a programming project to solve
that problem—not necessarily in polynomial time! Another backtracking application is presented, with the
same BackTrack class that was introduced in Chapter 5.
The website includes all programs developed in each chapter, all JUnit 4 tests, and applets, where
appropriate, to animate the concepts presented.

APPENDIXES
Appendix 1 has two additional features of the Java Collections Framework. Each of the collection classes in
the framework is serializable, that is, an instance of the class can be conveniently stored to an output stream,
and the instance can later be re-constituted from an input stream (de-serialization). Framework iterators
are fail-fast: During an iteration through a collection, there should be no insertions into or removals from
xxii PREFACE

the collection except by the iterator. Otherwise, the integrity of that iterator may be compromised, so an
exception will be thrown as soon as the iterator’s unreliability has been established.
Appendix 2 contains the background that will allow students to comprehend the mathematical aspects
of the chapters. Summation notation and the rudimentary properties of logarithms are essential, and the
material on mathematical induction will lead to a deeper appreciation of recursion as well as the analysis
of binary trees.
Appendix 3, “Choosing a Data Structure,” can be viewed as a summary of the eight major data
structures in the book. These collection classes are categorized according to their ordering of elements (for
example, time-based for stacks and queues) and according to their performance of standard operations (for
example, the TreeMap class requires logarithmic-in-n time to search for a key). Table A3.1 summarizes
the summary.

ORGANIZATION OF THE LABS


There are 23 web labs associated with this text. For both students and instructors, the initial Uniform
Resource Locator (URL) is www.wiley.com/college/collins.
The labs do not contain essential material, but provide reinforcement of the text material. For example,
after the ArrayList and LinkedList classes have been investigated, there is a lab to perform some timing
experiments on those two classes.
The labs are self-contained, so the instructor has considerable flexibility in assigning the labs:
a. they can be assigned as closed labs;
b. they can be assigned as open labs;
c. they can be assigned as ungraded homework.
In addition to the obvious benefit of promoting active learning, these labs also encourage use of the
scientific method. Basically, each lab is set up as an experiment. Students observe some phenomenon,
such as creating a greedy cycle to solve the Traveling Salesperson Problem. They then formulate and
submit a hypothesis —with their own code—about the phenomenon. After testing and, perhaps, revising
their hypothesis, they submit the conclusions they drew from the experiment.

ACKNOWLEDGEMENTS
Joshua Bloch, lead designer of the Java Collections Framework, gave valuable insights on type parameters
and their impact on the Java Collections Framework.
Chun Wai Liew of Lafayette College helped to incorporate JUnit into this edition of the text.
I am indebted to the suggestions and corrections of the reviewers: Dean Hendrix (Auburn University),
Benjamin Kuperman (Oberlin College), Andrew Haas (State University of New York—Albany), Kathy
Liszka (University of Akron), Paul Bladek (Edmonds Community College), Siva Jasthi (Metropolitan State
University), Hashem Anwari (Northern Virginia Community College), Alan Peslak (Nova Southeastern
University), H. K. Dai (Oklahoma State University), Jiang Li (Austin Peay State University), Paul J.
Wagner (University of Wisconsin—Eau Claire), John Mallozzi (Iona College), Robert Goldberg (Queens
College), and Michael Clancy (University of California—Berkeley).
Introduction to Java CHAPTER 0

This is a book about programming: specifically, about understanding and using data structures and
algorithms. The Java Collections Framework has a considerable number of data structures and
algorithms. Subsequent chapters will focus on what the framework is and how to use the framework
in your programs. For this information to make sense to you, you will need to be familiar with certain
aspects of Java that we present in this chapter. All of the material is needed, either for the framework
itself or to enable you to use the framework in your programming projects.

CHAPTER OBJECTIVES
1. Learn (or review) the fundamentals of Java, including classes, objects and messages.
2. Be able to use javadoc in writing method specifications.
3. Incorporate the Scanner class into your programming.
4. Understand the significance of the fact that a copy of the argument is stored in the corre-
sponding parameter when a method is called.
5. Understand the details of arrays and output formatting.

0.1 Java Fundamentals


Every Java program is a collection of classes. Basically, a class consists of variables, called fields, together
with functions, called methods, that operate on those fields. A program is executed when a special method,
the main method, is called by the run-time system (also known as the Java Virtual Machine). The heading
of this method is fixed, as shown in the following program:
public class HelloWorld
{
public static void main (String [ ] args)
{
System.out.println ("Hello, world!");
} // method main
} // class HelloWorld

The main method in this program calls another method, println, to produce the following output to the
console window:
Hello, world!

1
Random documents with unrelated
content Scribd suggests to you:
Then the fiddles struck up the air of ‘Sur le pont d’Avignon,’ and
the whole company formed up into circles for the opening Branle.
There was her father, grimacing and leaping like a baboon in a
nightmare, grave magistrates capering like foals, and giving
smacking kisses to their youthful partners, young burghers shouting
the words at the top of their voices. The whole scene seemed to
Madeleine to grow every minute more unreal.
Then the fiddles stopped and the circles broke up into laughing,
breathless groups. A young bourgeois, beplumed and beribboned,
and wearing absurd thick shoes, came up to her, and taking off his
great hat by the crown, instead of, in the manner of ‘les honnêtes
gens,’ by the brim, made her a clumsy bow. He began to ‘galantise’
her. Madeleine wondered if he had learned the art from the elephant
at a fair. She fixed him with her great, still eyes. Then she found
herself forced to lead him out to dance a Pavane. The fiddles were
playing a faint, lonely tune, full of the sadness of light things bound
to a ponderous earth, for these were the days before Lulli had made
dance tunes gay. The beautiful pageant had begun—the Pavane,
proud and preposterous as a peacock or a Spaniard. Then some old
ladies sitting round the room began in thin, cracked voices to sing
according to a bygone fashion, the words of the dance:—

‘Approche donc, ma belle,


Approche-toi, mon bien;
Ne me sois plus rebelle,
Puisque mon cœur est tien;
Pour mon âme apaiser,
Donne mois un baiser.’

They beat time with their fans, and their eyes filled with tears.
Gradually the song was taken up by the whole room, the words
rising up strong and triumphant:—

‘Approche donc, ma belle,


Approche-toi, mon bien——’
Madeleine’s lips were parted into a little smile, and her spellbound
eyes filled with tears; then she saw Jacques looking at her and his
eyes were bright and mocking. She blushed furiously.
‘He is like Hylas, the mocking shepherd in the Astrée,’ she told
herself. ‘Hylas, hélas, Hylas, hélas,’ she found herself muttering.
After another pause for Galanterie and preserved fruits, the violins
broke into the slow, voluptuous rhythm of the Saraband. The old
ladies again beat time with their fans, muttering ‘vraiment cela
donne à rêver.’
Madeleine danced with Jacques and he never took his eyes from
her face, but hers were fixed and glassy, and the words of the
Sapphic Ode, ‘that man seems to me the equal of the gods’ ...
clothed itself, as with a garment, with the melody.
She was awakened from her reverie by feeling Jacques’s grasp
suddenly tighten on her hand. She looked at him, he was white and
scowling. A ripple of interest was passing over the dancers, and all
eyes were turned to the door. Two or three young courtiers had just
come in, attracted by the sound of the fiddles. For in those days
courtiers claimed a vested right to lounge uninvited into any
bourgeois ball, and they were always sure of an obsequious
welcome.
There was the Président Troguin puffily bowing to them, and the
Présidente bobbing and smirking and offering refreshment. Young
Brillon, the giver of the fiddles, had left his partner, Marguerite
Troguin, and was standing awkwardly half-way to the door, unable to
make up his mind whether he should doff his hat to the courtiers
before they doffed theirs to him; but they rudely ignored all three,
and, swaggering up to the fiddles, bade them stop playing.
‘Foi de gentilhomme, I vow that it is of the last consequence that
this Saraband should die. It is really ubiquitous,’ lisped one of them,
a little muguet, with a babyish face.
‘It must be sent to America with the Prostitutes,’ said another.
‘That is furiously well turned, Vicomte. Really it deserves to be put
to the torture.’
‘Yes, because it is a danger to the kingdom, it debases the
coinage.’
‘Why?’
‘Because it generates tender emotions in so many vulgar bosoms
turning thus the fine gold of Cupid into a base alloy!’
‘Bravo! Comte, tu as de l’esprit infiniment.’
During this bout of wit, the company had been quite silent, trying
hard to look amused, and in the picture.
‘My friends, would you oblige us with the air of a Corante?’ the
Vicomte called out with a familiar wink to the ‘Four Fiddles,’ with
whom it behoved every fashionable gallant to be on intimate terms.
The ‘Fiddles’ with an answering wink, started the tune of this new
and most fashionable dance.
‘Ah! I breathe again!’ cried the little Marquis. They then proceeded
to choose various ladies as partners, discussing their points, as if
they had been horses at a Fair. The one they called Comte, a tall,
military looking man, chose Marguerite Troguin, at which Brillon tried
to assert himself by blustering out that the lady was his partner. But
the Comte only looked him up and down, with an expression of
unutterable disgust, and turning to the Marquis, asked: ‘What is this
thing?’ Brillon subsided.
Then they started the absurd Corante. The jumping steps were
performed on tip-toe, and punctuated by countless bows and
curtseys. There was a large audience, as very few of the company
had yet learned it. When it was over, it was greeted with enthusiastic
applause.
The courtiers proceeded to refresh themselves with Hippocras and
lemonade. Suddenly the little Marquis seized the cloak of the Comte,
and piped out in an excited voice:—
‘Look, Comte, over there ... I swear it is our old friend, the ghost
of the fashion of 1640!’
‘It is, it is, it’s the black shadow of the white Ariane! The crotesque
and importunate gallant!’ They made a dash for Monsieur
Troqueville, who was trying hard to look unconscious, and leaping
round him beset him with a volley of somewhat questionable jests.
All eyes were turned on him, eyebrows were raised, questioning
glances were exchanged. Madame Troqueville sat quite motionless,
gazing in front of her, determined not to hear what they were
saying. She would not be forced to see things too closely.
When they had finished with Monsieur Troqueville, they bowed to
the Présidente, studiously avoiding the rest of the company in their
salutation, and, according to their picture of themselves, minced or
swaggered out of the room. Jacques followed them.
This interlude had shaken Madeleine out of her vastly agreeable
dreams. The muguets had made her feel unfinished and angular,
and they had not even asked her to dance. Then, their treatment of
her father had been a sharp reminder that after all she was by birth
nothing but a contemptible bourgeoise. But as the evening’s gaiety
gradually readjusted itself, so did her picture of herself, and by the
time of the final Branle, she was once more drunk with vanity and
hope.
The Troguins sent them back in their own coach, and the drive
through the fantastic Paris of the night accentuated Madeleine’s
sense of being in a dream. There passed them from time to time
troops of tipsy gallants, their faces distorted by the flickering lights
of torches, and here and there the lanternes vives of the pastry-
cooks—brilliantly-lighted lanterns round whose sides, painted in gay
colours, danced a string of grimacing beasts, geese, and apes, and
hares and elephants—showed bright and strange against the
darkness.
Then the words:—
La joie! la joie! Voilà des oublies! echoed melancholy in the
distance. It was the cry of the Oublieux, the sellers of wafers and
the nightingales of seventeenth century Paris, for they never began
to cry their wares before dusk.
La joie! la joie! Voilà des oublies!
Oublie, oublier! The second time that evening there came into
Madeleine’s head a play on words.
La joie! la joie! Voilà des oublies! Could it be that the secret of la
joie was nothing but this dream-sense and—l’oubli?
They found Jacques waiting for them, pale but happy. He would
not tell them why he had left the ball-room, but he followed
Madeleine to her room. He was limping. And then, with eyes bright
with triumph, he described how, at their exit from the ball-room, he
had rallied the Clercs of the Bazoche (they had stayed to play cards
with the Troguin’s household), how they had followed the courtiers,
and, taking them by surprise, had given them the soundest
cudgelling they had probably ever had in their lives. ‘Though they
put up a good fight!’ and he laughed ruefully and rubbed his leg.
‘How came it that they knew my father?’ Madeleine asked.
Jacques grinned.
‘Oh, Chop, should I tell you, it would savour of the blab ... yet, all
said, I would not have you lose so good a diversion ... were I to tell
you, you would keep my counsel?’
‘Yes.’
Then he proceeded to tell her that her father had fallen in love in
Lyons with a courtesan called Ariane. She had left Lyons to drive her
trade in Paris, and that was the true cause of his sudden desire to do
the same. On reaching Paris, his first act was to buy from the stage
wardrobe of the Hôtel de Bourgogne, an ancient suit of tawdry
finery, which long ago had turned a courtier into the Spirit of Spring
in a Royal Ballet. This he had hidden away in the attic of an old
Huguenot widow who kept a tavern on the Mont Sainte-Geneviève,
and had proceeded to pester Ariane with letters and doggerel
imploring an interview—but in vain! Finally, he had taken his courage
in both hands, and donning his finery—‘which he held to have the
virtue of the cestus of Venus!’ laughed Jacques—he had boldly
marched into Ariane’s bedroom, only to be received by a flood of
insults and ridicule by that lady and her gallants.
Madeleine listened with a pale, set face. Why had she been so
pursued these last few days by her father’s sordid amours?
‘So this ... Ariane ... rejected my father’s suit?’ she said in a low
voice.
‘Ay, that she did! How should she not?’ laughed Jacques.
‘And you gave your suffrage to the foolish enterprise?’
Jacques looked rather sheepish.
‘I am not of the stuff that can withstand so tempting a diversion—
why, ’twill be a jest to posterity! His eager, foolish, obsequious face;
and his tire! I’faith, I would not have missed it for a kingdom!’ and
he tossed back his head and laughed delightedly.
Hylas, hélas!... Jacques was limping ... Vulcan was lame, wasn’t
he? ‘In the smithy of Vulcan weapons are being forged that will
smash up your world of galanterie and galamatias into a thousand
fragments!’
‘Why, Chop, you look sadly!’ he cried, with sudden contrition. ‘’Tis
finished and done with, and these coxcombs’ impudence bred them,
I can vouch for it, a score of bruises apiece! Chop, come here! Why,
the most modish and galant folk have oftentimes had the strangest
visionnaires for fathers. There is Madame de Chevreuse—who has
not heard of the naïvetés and visions of her father? And ’twas a
strange madman that begot the King himself!’ he said, thinking to
have found where the shoe pinched. But Madeleine remained silent
and unresponsive, and he left her.
Yes, why had she been so pursued these last few days by her
father’s amours? It was strange that love should have brought him
too from Lyons! And he too had set his faith on the magical
properties of bravery! What if.... Then there swept over her the
memory of the Grecian Sappho, driving a host of nameless fears
back into the crannies of her mind. Besides—to-morrow began the
new era!
She smiled ecstatically, and, tired though she was, broke into a
triumphant dance.
CHAPTER IX
AT THE HÔTEL DE RAMBOUILLET

When Madeleine awoke next morning, the feeling she had had
over night of being in a dream had by no means left her.
From the street rose the cries of the hawkers:—

‘Ma belle herbe, anis fleur.’


‘A la fraîche, à la fraîche, qui veut boire?’
‘A ma belle poivée à mes beaux épinards! à mon bel
oignon!’

And then shrill and plaintive:—

‘Vous désirez quelque cho-o-o-se?’

It was no longer a taunt but the prayer of a humble familiar asking


for its mistress’s orders, or, rather, of Love the Pedlar waiting to sell
her what she chose. She opened her window and looked out. The
length of the narrow street the monstrous signs stuck out from
either side, heraldic lions, and sacred hearts, and blue cats, and
mothers of God, and Maréchales looking like Polichinelle. It was as
incongruous an assortment as the signs of the Zodiac, as flat and
fantastic as a pack of cards——
‘Vous désirez quelque cho-o-ose?’ She laughed aloud. Then she
suddenly remembered her vague misgivings of the night before. She
drew in her head and rushed to her divination book. These were the
lines her eyes fell upon:—

‘ ... and she seemed in his mind to have said a thousand


good things, which, in reality, she had not said at all.’
For one moment Madeleine’s heart seemed to stop beating. Did it
mean that she was not going to get in her prepared mots? No, the
true interpretation was surely that Mademoiselle de Scudéry would
think her even more brilliant than she actually was. She fell on her
knees and thanked her kind gods in anticipation.
However, she too must do her part, must reinforce the Power
behind her, so over and over again she danced out the scene at the
Hôtel de Rambouillet, trying to keep it exactly the same each time.
‘Ah! dear Zénocrite! here you come, leading our new Bergère.’
All the morning she seemed in a dream, and her mother, father,
Jacques, and Berthe hundreds of miles away. She could not touch a
morsel of food. ‘Ah! the little creature with wings. I know, I know,’
Berthe kept muttering.
With her throat parched, and still in a strange, dry dream, she
went to dress. The magical petite-oie seemed to her to take away all
shabbiness from the serge bodice and the petticoat of camelot de
Hollande. Then, in a flash, she remembered she had decided to add
to her purchases at the Fair a trimming of those wonderful imitation
jewels known as the pierreries du Temple. The petite-oie had taken
on the exigency of a magic formulary, and its contents, to be
efficacious, had to conform as rigidly to the original conception as a
love-potion must to its receipt. In a few minutes she would have to
start, and the man who sold the stones lived too far from Madame
Cornuel for her to go there first. She was in despair.
At that moment the door opened, and in walked Jacques; as a rule
he did not come home till evening. He sheepishly brought out of his
hose an elaborate arrangement of green beads.
‘Having heard you prate of the pierreries du Temple, I’ve brought
you these glass gauds. I fear me they aren’t from the man in the
Temple, for I failed to find the place ... but these seemed pretty
toys. I thought maybe they would help you to cut a figure before old
Dame Scudéry.’
It was truly a strange coincidence that he should have brought her
the very thing that at that very moment she had been longing for.
But was it the very thing? For the first time that morning, Madeleine
felt her feet on earth. The beads were hideous and vulgar and as
unlike the pierreries du Temple as they were unlike the emeralds
they had taken as their model. She was almost choked by a feeling
of impotent rage.
How dare Jacques be such a ninny with so little knowledge of the
fashion? How dare he expect a belle to care for him, when he was
such a miserable gallant with such execrable taste in presents? The
idea of giving her rubbish like that! She would like to kill him!
Always quick to see omens, her nerves, strung up that morning to
their highest pitch, felt in the gift the most malignant significance.
Timeo Danaos et dona ferentes—I fear the Greeks even when they
bear gifts. She blanched, and furtively crossed herself. Having said,
in a dead voice, some words of thanks, she silently pinned the bead
trimming on to her bodice and slowly left the room.
It was time to start; she got into the little box-like sedan. There
was her mother standing at the door, waving her hand, and wishing
her good luck. She was soon swinging along towards the Seine.
When the house was out of sight, with rude, nervous fingers she
tore off the beads, and they fell in a shower about the sedan.
Though one could scarcely move in the little hole, she managed to
pick them all up, and pulling back the curtain she flung them out of
the window. They were at that moment crossing the Pont-Neuf, and
she caught a glimpse of a crowd of beggars and pages scrambling to
pick them up. Recklessly scattering jewels to the rabble! It was like a
princess in Amadis, or like the cardinal’s nieces, the two Mancini,
whose fabulous extravagance was the talk of the town. Then she
remembered that they were only glass beads. Was it an omen that
her grandeur would be always a mere imitation of the real thing?
Also—though she had got rid of the hateful trimming, her petite-oie
was still incomplete. Should she risk keeping Madame Cornuel
waiting and go first to the man in the Temple? No, charms or no
charms, she was moving on to her destiny, and felt deadly calm.
What she had prayed for was coming and she could not stop it now.
Its inevitableness frightened her, and she began to feel a poignant
longing for the old order, the comforting rhythm of the rut she was
used to, with the pleasant feeling of every day drawing nearer to a
miraculous transformation of her circumstances.
She pulled back the curtain again and peeped out, the Seine was
now behind them, and they were going up la rue de la Mortellerie.
Soon she would be in the clutches of Madame Cornuel, and then
there would be no escape. Should she jump out of the sedan, or tell
the porters to take her home? She longed to; but if she did, how
was she to face the future? And what ingratitude it would be for the
exquisite tact with which the gods had manipulated her meeting
with Sappho! the porters swung on and on, and Madeleine leaned
back and closed her eyes, hypnotised by the inevitable.
The shafts of the sedan were put down with a jerk, and Madeleine
started up and shuddered. One of the porters came to the window.
‘Rue Saint-Antoine, Mademoiselle.’ Madeleine gave him a coin to
divide with his companion, opened the door, and walked into the
court. Madame Cornuel’s coach was standing waiting before the
door.
She walked in and was shown by a valet into an ante-room. She
sat down, and began mechanically repeating her litany. Suddenly,
there was a rich rustle of taffeta, the door opened, and in swept a
very handsomely-dressed young woman. Madeleine knew that it
must be Mademoiselle le Gendre, the daughter of Monsieur Cornuel’s
first wife. In a flash Madeleine took in the elegant continence of her
toilette. While Madeleine had seven patches on her face, she had
only three. Her hair was exquisitely neat, and she was only slightly
scented, while her deep, plain collar à la Régente, gave an air of
puritanic severity to the bright, cherry-coloured velvet of her bodice.
Also, she was not nearly as décolletée as Madeleine.
Madeleine felt that all of a sudden her petite-oie had lost both its
decorative and magical virtue and had become merely incongruous
gawds on the patent shabbiness of her gown. For some reason there
flashed through her head the words she had heard at the Fair: ‘As if
all the purple and fine linen of Solomon himself could add an ounce
of comeliness to his antic, foolish face.’
‘Mademoiselle Troqueville? My step-mother awaits us in the coach,
will you come?’ said the lady. Her manner was haughty and
unfriendly. Madeleine realised without a pang that it would all be like
this. But after all, nothing in this dull reality really mattered.
‘Bestir yourself! ’Tis time we were away!’ shouted a voice from the
carrosse. Mademoiselle le Gendre told Madeleine to get in.
‘Mademoiselle Troqueville? I am glad to make your acquaintance—
pray get in and take the back seat opposite me.’ Madeleine humbly
obeyed, indifferent to what in her imaginings she would have looked
upon as an unforgivable insult, the putting her in the back seat.
‘Hôtel de Rambouillet,’ Madame Cornuel said to a lackey, who was
waiting for orders at the window. The words left Madeleine quite
cold.
Madame Cornuel and her step-daughter did not think it necessary
to talk to Madeleine. They exchanged little remarks with each other
at intervals, and laughed at allusions which she could not catch.
‘Are we to fetch Sappho?’ suddenly asked the younger woman.
‘No, she purposes coming later, and on foot.’
Madeleine heard the name without a thrill.
The coach rolled on, and Madeleine sat as if petrified. Suddenly
she galvanised herself into activity. In a few minutes they would be
there, and if she allowed herself to arrive in this condition all would
be lost. Why should she let these two horrid women ruin her chance
of success? She muttered quickly to herself:—
‘Oh! blessed Virgin, give me the friendship of Mademoiselle de
Scudéry,’ and then started gabbling through her prepared scene.
‘“Ah, dear Zénocrite, here you come, leading our new
bergère!” cries the lady on the bed. “Welcome, Mademoiselle,
I have been waiting with impatience to make your
acquaintance.”’

Would she get it finished before they arrived? She felt all her
happiness depended on it.

‘“Madame, it would have been of no consequence, for the


Sibyl herself would have taken the conqueror captive.... But,
Mademoiselle, what, if you will pardon my curiosity, induced
you to leave your agreeable prairies?”’

They were passing the Palais Cardinal—soon they would turn


down the rue St Thomas du Louvre—she had not much time.
The coach was rolling into the court of the Hôtel de Rambouillet
and she had not finished. They got out. A tall woman, aged about
thirty, with reddish hair and a face badly marked by smallpox, but in
spite of these two blemishes of an extremely elegant and
distinguished appearance, came towards them, screwing up her eyes
in the manner of the near-sighted. Her top petticoat was full of
flowers; she was too short-sighted to recognise Madame Cornuel till
she was quite close, then she dropped a mock-low curtsey, and
drawled ‘Ma-a-a-dame.’ Madame Cornuel laughed: evidently she had
imitated a mutual acquaintance. With a sudden sense of exclusion
Madeleine gave up hope.
‘Are you following the example of our friend of the Faubourg St-
Germain, may I inquire?’ asked Madame Cornuel, with a little smile,
pointing to the flowers, at which her step-daughter laughed, and the
tall red-haired lady made a moue and answered with a deep sigh:—
‘Ah! the wit of the Marais!’ The meaning of this esoteric persiflage
was entirely lost on Madeleine, and she sat with an absolutely
expressionless face, trying to hide her own embarrassment.
‘Ah! pardon me, I had forgotten,’ Madame Cornuel exclaimed.
‘Mademoiselle de Rambouillet, allow me to present to you
Mademoiselle Troqueville.’ (It may have been Madeleine’s
imagination, but it seemed to her that Madame Cornuel paused
before calling her Mademoiselle.) Mademoiselle de Rambouillet
screwed up her eyes at her and smiled quite pleasantly, while
Madeleine, absolutely tongue-tied, tried to perform the almost
impossible task of curtseying in a coach. They got out, and went
inside, the three others continuing their mystifying conversation.
They went up a staircase and through one large splendid room
after another. So here was Madeleine, actually in the famous ‘Palais
de Cléomire,’ as it was called in Cyrus, but the fact did not move her,
indeed she did not even realise it. Once Mademoiselle de
Rambouillet turned round and said to her:—
‘I fear ’tis a long journey, Mademoiselle,’ but the manner in which
she screwed up her eyes both terrified and embarrassed her, so
instead of answering she merely blushed and muttered something
under her breath.
Finally they reached Madame de Rambouillet’s bedroom (she had
ceased for some years to receive in the Salle Bleue). She was lying
on a bed in an alcove and there were several people in the ruelle; as
the thick velvet curtains of the windows were drawn Madeleine got
merely an impression of rich, rare objects glowing like jewels out of
the semi-darkness, but in a flash she took in the appearance of
Madame de Rambouillet. Her face was pale and her lips a bright
crimson, which was obviously not their natural colour; she had large
brown eyes with heavy pinkish eyelids, and the only sign that she
was a day over fifty was a slight trembling of the head. She was
wearing a loose gown of some soft gray material, and on her head
were cornettes of exquisite lace trimmed with pale yellow ribbons.
One of her hands was lying on the blue coverlet, it was so thin that
its veins looked almost like the blue of the coverlet shining through.
The fingers were piled up with beautiful rings.
There was a flutter round the bed, and then Madeleine found
herself being presented to the Marquise.
‘Ah! Mademoiselle Toctin, I am ravished to make your
acquaintance,’ she said in a wonderfully melodious voice, with a just
perceptible Italian accent. ‘You come from delicious Marseilles, do
you not? You will be able to recount to us strange Orient romances
of orange-trees and Turkish soldiers. Angélique, bring Mademoiselle
Touville a pliant, and place it close to me, and I will warm myself at
her Southern historiettes.’
‘It is from Lyons that I come, not from Marseilles,’ was the only
repartee of which at the moment Madeleine was capable. Her voice
sounded strange and harsh, and she quite forgot a ‘Madame.’
However, the Marquise did not hear, as she had turned to another
guest. But Angélique de Rambouillet heard, and so did another lady,
with an olive complexion and remarkably bright eyes, whom
Madeleine guessed to be Madame de Montausier, the famous
‘Princesse Julie.’ They exchanged glances of delight, and Madeleine
began to blush, and blush, though, as a matter of fact, it was by
their mother they were amused.
In the meantime a very tall, elderly man, with a hatchet face,
came stumbling towards her.
‘You have not a chair, have you, Mademoiselle?’
‘Here it is, father,’ said Angélique, who was bringing one up.
‘Ah! that is right, Mademoiselle er ... er ... er ... will sit here.’
Madeleine took to this kind, polite man, and felt a little happier. He
sat down beside her and made a few remarks, which Madeleine, full
of the will to be agreeable, answered as best she could,
endeavouring to make up by pleasant smiles for her sudden lack of
esprit. But, unfortunately, the Marquis was almost stone-blind, so
the smiles were lost upon him, and before long Madeleine noticed by
his absent laugh and amused expression that his attention was
wandering to the conversation of the others.
‘I am of opinion you would look inexpressibly galant in a scarlet
hat, Marquis,’ Madame de Rambouillet was saying to a short,
swarthy man with a rather saturnine expression. They all looked at
him mischievously. ‘Julie would be obliged to join Yvonne in the
Convent, but there would be naught to hinder you from keeping
Marie-Julie at your side as your adopted daughter.’ The company
laughed a little, the laugh of people too thoroughly intimate to need
to make any effort. ‘Monsieur de Grasse is wearing his episcopal
smile—look at him, pray! Come, Monseigneur, you must confess that
a scarlet hat would become him to a marvel,’ and Madame de
Rambouillet turned her brilliant, mischievous eyes on a tiny prelate
with a face like a naughty schoolboy’s.
He had been called Monsieur de Grasse. Could he, then, be the
famous Godeau, bishop and poet? It seemed impossible. For Saint
Thomas is the patron saint of provincials when they meet celebrities
in the flesh.
‘I fear Monsieur’s head would be somewhat too large to wear it
with comfort,’ he answered.
‘Hark to the episcopal fleurette! Marquis, rise up and bow!’ but the
only answer from the object of these witticisms was a surly grunt.
Another idle smile rippled round the circle, and then there fell a
silence of comfortable intimacy. If Madeleine had suddenly found
herself in the kingdom of Prester John she could not have
understood less of what was going on around her.
‘Madame Cornuel has a furiously galante historiette she is burning
to communicate to us,’ said Mademoiselle de Rambouillet, screwing
up her eyes at Madame Cornuel.
‘Julie, bid Monsieur de Grasse go upstairs to play with Marie-Julie,
and then Madame Cornuel will tell it.’
‘Monsieur de Grasse——’
‘Madame la Marquise come to my rescue! I too would fain hear
the historiette!’
‘Nolo episcopari, hein?’
‘Now, then, be obedient, and get you to Marie-Julie!’
‘Where can I take refuge?’
‘If there were a hazel-nut at hand, ’twould serve your purpose.’
‘No, Madame la Marquise, permit me to hide within your locket.’
‘As you will. Now, Madame, we are all attention.’
Throughout this fooling, Madeleine had sat with aching jaws
stretched into a smile, trying desperately hard not to look out of it.
They all looked towards Madame Cornuel, who sat smiling in
unruffled silence.
‘Madame?’
‘Well, Mademoiselle, tell me who is to be its heroine, who its hero,
and what its plot, and then I will recount it to you,’ she said. They
seemed to think this very witty, and laughed heartily. There was
another pause, and Madeleine again made an attempt to engage the
Marquis’s attention.
‘The ... the ... the houses in Paris ... seem to me most goodly
structures,’ she began. He gave his nervous laugh.
‘Yes, yes, we have some rare architects these days. Have you
been to see the new buildings of the Val de Grâce?’
‘No, I have not ... er ... it is a Convent, is it not?’
‘Yes. Under the patronage of Notre Dame de la Crêche.’
His attention began to wander again; she made a frantic effort to
rekindle the flames of the dying topic.
‘What a strange name it is—Val de Grâce, what do you think can
be its meaning?’
‘Yes, yes,’ with his nervous laugh, ‘Val de Grâce, doubtless there is
some legend connected with it.’
Madeleine gave up in despair.
The languid, intimate talk and humorous silences had suddenly
turned into something more animated.
‘Madame de Sablé vows that she saw her there with her own
eyes, and that she was dressed in a justaucorps.’
‘Sophie has seen more things than the legendary Argos!’
‘Well, it has been turned into a Vaudeville in her quarter.’
‘In good earnest, has it? What an excellent diversion! Julie, pray
ask Madame d’Aiguillon about it and tell us. Go to-day.’
‘I daren’t; “my dear, my dear, cela fait dévotion and that puts me
in mind, the Reine-Mère got a special chalice of Florentine enamel
and I must——” Roqueten, Roqueten, Roquetine.’
‘Upon my life, the woman’s talk has less of meaning than a
magpie’s!’ growled Madeleine to herself.
At that moment the door opened and in came a tall, middle-aged
woman, swarthy, and very ugly. She was dressed in a plain gown of
gray serge. Her face was wreathed in an agreeable smile, that made
her look like a civil horse.
Madeleine had forgotten all about Mademoiselle de Scudéry, but
when this lady came in, it all came rushing back; she got cold all
over, and if before she had longed to be a thousand miles away, she
now longed to be ten thousand.
There was a general cry of:—
‘Mademoiselle: the very person we were in need of. You know
everything. Tell us all about the Présidente Tambonneau, but avoid,
in your narration, an excessive charity.’
‘If you talk with the tongues of men and of Angels and yet have
Charity, ye are become as sounding brass and as a tinkling cymbal,’
said Madame Cornuel in her clear, slow voice. She spoke rarely, but
when she did it was with the air of enunciating an oracle.
‘Humph! That is a fault that you are rarely guilty of!’ growled
Montausier quite audibly.
‘The Présidente Tambonneau? No new extravagance of hers has
reached my ears. What is there to tell?’ said the new-comer. She
spoke in a loud, rather rasping voice, and still went on smiling civilly.
‘Oh, you ladies of the Marais, every one is aware that you are
omniscient, and yet you are perfect misers of your historiettes!’
‘Sappho, we must combine against the quartier du Palais Cardinal,
albeit they do call us “omniscient.” It sounds infinitely galant, but I
am to seek as to its meaning,’ said Madame Cornuel.
‘Ask Mademoiselle, she is in the last intimacy with the Maréchal
des mots; it is reported he has raised a whole new company to fight
under his Pucelle.’
‘From all accounts, she is in sore need of support, poor lady.
Madame de Longueville says she is “parfaitement belle mais
parfaitement ennuyeuse,”’ said Mademoiselle de Rambouillet very
dryly.
‘That would serve as an excellent epitome of divers among our
friends,’ murmured Madame de Montausier.
‘Poor Chapelain! all said, he, by merely being himself, has added
infinitely more to our diversion than the wittiest person in the world,’
said Madame de Rambouillet, looking mischievously at Mademoiselle
de Scudéry, who, though still wearing the same smile, was evidently
not pleased.
‘Yes, Marquis, when you are made a duke, you would do well to
employ Monsieur Chapelain as your jester. Ridiculous, solemn people
are in reality much more diverting than wits,’ said Mademoiselle de
Rambouillet to Montausier, who looked extremely displeased, and
said in angry, didactic tones:—
‘Chapelain a des sentiments fins et delicats, il raisonne juste, et
dans ses œuvres on y trouve de nobles et fortes expressions,’ and
getting up he walked over to Mademoiselle de Scudéry, and they
were soon talking earnestly together.
Madeleine all this time had been torn between terror of being
introduced to Mademoiselle de Scudéry, and terror of not being
introduced. Her face was absolutely impassive, and she had ceased
to pretend to take any interest in what was going on around her.
Suddenly she heard Madame de Rambouillet saying to Monsieur
de Grasse:—
‘You remember Julie’s and her sister’s vision about night-caps?’
‘Ah, yes, and the trick played on them by Voiture, and the poor,
excellent Marquis de Pisani.’
‘Yes,’ she answered, with a little sigh and a smile. ‘Well, it has
been inherited by little Marie-Julie, whenever she beholds one she
becomes transfixed by terror. Visions are strange things!’
Madeleine for the first time that afternoon felt happy and pleased.
She herself had always loathed night-caps, and as a child had
screamed with terror whenever she had seen any one wearing one.
What a strange coincidence that this vision should be shared by
Madame de Rambouillet’s daughters! She turned eagerly to the
Marquis.
‘Monsieur, I hear Madame la Marquise telling how Mesdames her
daughters were wont to be affrighted by night-caps; when I was a
child, they worked on me in a like manner, and to speak truth, to
this day I have a dislike to them.’
‘Indeed, indeed,’ he answered, with his nervous laugh. ‘Yes, my
daughters had quite a vision as to night-caps. Doubtless ’twas linked
in their memory with some foolish, monstrous fable they had heard
from one of their attendants. ’Tis strange, but our little
granddaughter has inherited the fear and she refuses to kiss us if we
are wearing one.’
Alas! There was no crack through which Madeleine could get in
her own personality! The Marquis got up and stumbled across the
room to Mademoiselle de Scudéry, and Montausier, having to give up
his chair, sat down by Madeleine. There was a cry of ‘Ah! here she
comes!’
The door opened and a little girl of about seven years old walked
into the room, followed by a gouvernante who stood respectfully in
the doorway. The child was dressed in a miniature Court dress, cut
low and square at the neck. She had a little pointed face, and eyes
with a slight outward squint. She made a beautiful curtsey, first to
her grandmother and then to the company.
‘My dearest treasure,’ Madame de Rambouillet cried in her
beautiful husky voice. ‘Come and greet your friend, Monsieur de
Grasse.’
Every one had stopped talking and were looking at the child with
varying degrees of interest. Madeleine felt suddenly fiercely jealous
of her; she stole a glance at Mademoiselle de Scudéry, and saw on
her face the universal smile of tolerant amusement with which
grown-up people regard children. The child went up to Godeau,
kissed his ring, and then busily and deliberately found a foot-stool
for herself, dragged it up to Madame de Rambouillet’s bed, and sat
down on it.
‘The little lady already has the tabouret chez la reine,’[2] said
Mademoiselle de Scudéry, smiling and bowing to Madame de
Rambouillet. The child, however, did not understand the witticism;
she looked offended, frowned, and said severely:—
‘I am working a tabouret for myself,’ and then, as if to soften what
she evidently had meant for a snub, she added: ‘It has crimson
flowers on it, and a blue saint feeding birds.’
Montausier went into fits of proud laughter.
‘There is a bit of hagiology for you to interpret, Monsieur de
Grasse,’ he cried triumphantly, suddenly in quite a good temper, and
looking round to see if the others were amused. Godeau looked
interested and serious.
‘That must be a most rare and delicate tabouret, Mademoiselle,’ he
said; ‘do you know what the saint’s name is?’
‘No, I thank you,’ she answered politely, but wearily, and they all
again went into peals of laughter.
‘My love,’ said Madame de Rambouillet. ‘I am certain Monsieur de
Grasse and that lady,’ nodding towards Mademoiselle de Scudéry,
‘would be enchanted by those delicious verses you wrote for my
birthday, will you recite them?’
But the child shook her head, backwards and forwards, the more
she was entreated, the more energetically she shook her head,
evidently enjoying the process for its own sake. Then she climbed on
to her grandmother’s bed and whispered something in her ear.
Madame de Rambouillet shook with laughter, and after they had
whispered together for some minutes the child left the room.
Madame de Rambouillet then told the company that Marie-Julie’s
reason for not wishing to recite her poem was that she had heard
her father say that all hommes de lettres were thieves and were
quite unprincipled about using each other’s writings, and she was
afraid that Mademoiselle de Scudéry or Monsieur de Grasse might, if
they heard her poem, publish it as their own. There was much
laughter, and Montausier was in ecstasies.
‘I am impatient for you to hear the poem,’ said Madame de
Rambouillet. ‘It is quite delicious.’
‘Yes, my daughter promises to be a second Neuf-germain!’[3] said
Madame de Montausier, smiling.
‘What a Nemesis, that a mother who has inspired so many
delicious verses, and a father——’ began Mademoiselle de Scudéry,
but just then the child came back with her head disappearing into a
large beplumed man’s hat, and carrying a shepherd’s crook in her
hand.
‘I am a Muse,’ she announced, and the company exchanged
delighted, bewildered glances.
‘Now, I will begin.’
‘Yes, pray do, my dear love,’ said Madame de Rambouillet, trying
to compose her face.
‘The initial letters form my grandmother’s name: Cathérine,’ she
explained, and then, taking her stand in the middle of the room,
began to declaim with great unction:—

‘Chérie, vous êtes aimable et


Aussi belle que votre perroquet,
Toujours souriante et douce.
Hélas! j’ai piqué mon pouce
En brodant pour votre jour de fête
Rien qu’une bourse qui n’est pas bête.
J’aime ma Grandmère, c’est ma chatte,
Nellie, mon petit chien, donne lui ta patte,
Et lèche la avec ta petite langue.’

She then made a little bow to the company, and sat down again
on her tabouret, quite undisturbed by the enthusiastic applause that
had followed her recitation.
‘Mademoiselle,’ began Godeau solemnly, ‘words fail me, to use the
delicious expression of Saint Amant, with which to praise your
ravishing verses as they deserve. But if the Abbé Ménage were here,
I think he might ask you if the qui in ... let me see ... the sixth line,
refers to the bourse or to the act of pricking your finger. Because if,
as I imagine, it is to the latter, the laws of our language demand the
insertion of a ce before the qui, while the unwritten laws of universal
experience assert that the action of pricking one’s finger should be
called bête not pas bête. We writers must be prepared for this sort
of ignoble criticism.’
‘Of course the qui refers to bourse,’ said Madame de Montausier,
for the child was looking bewildered. ‘You will pardon me but what
an exceeding foolish question from a Member of the Academy! It
was bête to prick one’s finger, but who, with justice, could call bête a
bourse of most quaint and excellent design? Is it not so, ma chatte?’
The child nodded solemnly, and Monsieur de Grasse was profuse in
his apologies for his stupidity.
Madeleine had noticed that the only member of the company,
except herself, who had not been entranced by this performance,
was Mademoiselle de Scudéry. Though she smiled the whole time,
and was profuse in her compliments, yet she was evidently bored.
Instead of pleasing Madeleine, this shocked her, it also made her
rather despise her, for being out of it.
She turned to Montausier and said timidly:—
‘I should dearly love to see Mademoiselle votre fille and the
Cardinal’s baby niece together. They would make a delicious pair.’
But Montausier either really did not hear, or pretended not to, and
Madeleine had the horrible embarrassment of speaking to air.
‘Who is that demoiselle?’ the child suddenly cried in a shrill voice,
looking at Madeleine.
‘That is Mademoiselle Hoqueville, my love.’
‘Hoqueville! what a droll name!’ and she went into peals of shrill
laughter. The grandparents and mother of the child smiled
apologetically at Madeleine, but she, in agony at being humiliated,
as she considered, before Mademoiselle de Scudéry, tried to improve
matters by looking haughty and angry. However, this remark
reminded Madame de Rambouillet of Madeleine’s existence, and she
exclaimed:—
‘Oh! Mademoiselle Hoqueville, you have, as yet, seen naught of
the hôtel. Marie-Julie, my love, go and say bon-jour to that lady and
ask her if she will accompany you to the salle bleue.’
The child obediently went over to Madeleine, curtseyed, and held
out her hand. Madeleine was not certain whether she ought to
curtsey back or merely bow without rising from the chair. She
compromised in a cross between the two, which made her feel
extremely foolish. On being asked if she would like to see la salle
bleue, she had to say yes, and followed the child out of the room.
She followed her through a little cabinet, and then they were in
the famous room, sung by so many poets, the scene of so many gay
and brilliant happenings.
Madeleine’s first feeling was one of intense relief at being freed
from the strain of the bedroom, then, as it were, she galvanised into
activity her demand upon life, and felt in despair at losing even a
few moments of Mademoiselle de Scudéry’s company. The child
walked on in front humming a little tune to herself. Madeleine felt
she must pull herself together, and make friends with her.
‘What rare and skilful verses those were you recited to us,’ she
began, her voice harshly breaking the silence of the huge room. The
child looked at her out of her crab-eyes, pursed up her mouth, and
went on humming.
‘Do you dearly love your little dog?’
‘Haven’t got one.’ This was startling.
‘But you made mention of one in your poem,’ said Madeleine in an
aggrieved tone.
The child screamed with scornful laughter:—
‘She isn’t mine, she’s Aunt Angélique’s!’ she cried, and looked at
Madeleine as if she must be mad for having made such a mistake.
There was another pause. Madeleine sighed wearily and went to
look at the famous tapestry, the child followed her.
Its design consisted of groups of small pastoral figures disporting
themselves in a blue Arcady. In one group there was a shepherdess
sitting on a rustic bench, surrounded by shepherds; a nymph was
offering her a basket of flowers. The child pointed to the
shepherdess: ‘That is my grandmother, and that is me bringing her
flowers, and that is my father, and that is Monsieur Sarrasin, and
that is my dear Maître Claude!’ ... This was better. Madeleine made a
violent effort to be suitably fantastic.
‘It may be when you are asleep you do in truth become that
nymph and live in the tapestry.’ The child stared at her, frowned, and
continued her catalogue:—
‘And that is my mother, and that is Aunt Angélique, and that is
Madame de Longueville, and that is Madame de Sablé, and that is
Monsieur de la Rochefoucauld, and that is my little friend
Mademoiselle de Sévigné,’ and so on.
When she had been through the list of her acquaintances, she
wandered off and began to play with a box of ivory puzzles.
Madeleine, in a final attempt to ingratiate herself, found for her
some of the missing pieces, at which her mouth began to tremble,
and Madeleine realised that all the pleasure lay in doing it by herself,
so she left her, and with a heavy heart crept back to the bedroom.
She found Madame Cornuel and Mademoiselle Legendre preparing
to go, and supposing they had already said good-bye, solemnly
curtseyed to all the company in turn. They responded with great
friendliness and kindness, but she suddenly noticed Madame Cornuel
exchanging glances with her step-daughter, and realised in a flash
that by making her adieux she had been guilty of a provincialism.
She smiled grimly to herself. What did it matter?
Madame Cornuel dropped her in the rue Saint-Honoré, and she
walked quietly home.
She had not exchanged a single word with Mademoiselle de
Scudéry.
CHAPTER X
AFTERWARDS

Madeleine walked up the petite rue du Paon, in at the baker’s


door, and upstairs. She still felt numbed, but knew that before her
were the pains of returning circulation; Madame Troqueville heard
her come in and ran out from the kitchen, full of smiles and
questions. Madeleine told her in a calm voice that it had all been
delightful, praised the agreeable manners of the Rambouillets, and
described the treasures of the salle bleue. She repeated the quaint
sayings of the child, and Madame Troqueville cried ‘Quel amour! Oh,
Madeleine, I would like you to have just such another little
daughter!’
Madeleine smiled wearily.
‘And what of Mademoiselle de Scu-tary?’ her mother asked rather
nervously.
‘De Scudéry,’ corrected Madeleine, true to habit. ‘She was furiously
spirituelle and very ... civil. I am a trifle tired.... I think I will away
and rest,’ and she dragged herself wearily off to her own room.
Madame Troqueville, who had watched her very unhappily, made as
if she would follow her, but thought better of it.
When Madeleine got into her room, she sat down on her bed, and
clasped her head. She could not, she would not think. Then, like a
wave of ecstasy there swept over her little points she had noticed
about Mademoiselle de Scudéry, but which had not at the time
thrilled her in the slightest. Her teeth were rather long; she had a
mole on her left cheek; she was not as grandly dressed as the
others; the child had snubbed her; Montausier had been very
attentive to her; she was a great celebrity; Madame de Rambouillet
had teased her. This medley of recollections, each and all of them
made her feel quite faint with pleasure, so desirable did they make
her love appear. But then ... she had not spoken to her ... she had
been humiliated before her.... Oh! it was not to be faced! Her teeth
were rather long. Montausier had been attentive to her ... oh, how
thrilling! And yet ... she, Madeleine had not even been introduced to
her. The supernal powers had seemed to have a scrupulous regard
for her wishes. They had actually arranged that the first meeting
should be at the Hôtel de Rambouillet ... and she had not even been
introduced to her! Could it be possible that the Virgin had played her
a trick? Should she turn and rend in mad fury the whole Heavenly
Host? No; that would be accepting defeat once for all, and that must
not be, for the past as well as the future was malleable, and it was
only by emotionally accepting it that a thing became a fact. This
strange undercurrent of thought translated itself thus in her
consciousness: God and the Virgin must be trusted; they had only
disclosed a tiny bit of their design, what madness then, to turn
against them, thus smashing perhaps their perfect scheme for her
happiness! Or perhaps her own co-operation had not been adequate
—she had perhaps not been instant enough in dancing—but still ...
but still ... the visit to the Hôtel de Rambouillet was over, she had
seen Mademoiselle de Scudéry, and was still not one inch nearer to
her heart’s desire. She could not face it.
She came down to supper. Her father was silent and gloomy,
shaking his head and twisting his lips. His visit to his lady had been a
failure. Was there ... could there be ... some mystical connection?
And there was Jacques still limping ... and he had given her that
horrid bead trimming.... No, no, no ... these were insane, goblin
ideas that must be crushed.
Her mother was trying hard to be cheerful, and Jacques kept
looking at her anxiously. When supper was over she went up to her
room, half hoping, half fearing that he would follow.
Shortly there was a scratch at the door (with great difficulty she
had persuaded him to adopt the fashionable scratch—to knock was
bourgeois).
He came in, and gave her a look with his bright eyes, at once
compassionate and whimsical. She felt herself dully hoping that he
would not ask why she was not wearing the bead trimming. He did
not, but began to tell her of his day, spent mostly at the Palais and a
tavern. But all the time he watched her; she listened languidly. ‘How
went the fête galante?’ he asked, after a pause.
‘It was furiously galante,’ she answered with a tragic smile. He
walked slowly up to her, half smiling all the time, sat down on her
bed, and put his arm around her.
‘You are cruelly unhappy, my poor one, I know. But ’twill pass, in
time all caprices yield to graver things.’
‘But it is no caprice!’ she cried passionately. ‘Oh, Jacques, it is hard
to make my meaning clear, but they be real live people with their
own pursuits ... they are all square like little fat boxes ... oh, how
can I make you understand?’
Jacques could not help laughing. ‘I’m sure, ’tis hateful of them to
be like boxes; though, in truth, for my part, I am to seek ... oh,
Madeleine, dear life, it’s dreadful to be miserable ... the cursed
phantasia, what tricks it plays us ... ’tis a mountebank, don’t heed it
but put your faith in the good old bourgeois intellect,’ but Madeleine,
ignoring this comfort from Gassendi, moaned out,—
‘Oh! Jacques! I want to die ... you see, ’tis this way—they’ve got
their own lives and memories, folded up all tight around them. Oh!
can no one ever get to know any one else?’
He began to understand.
‘Indeed one can, but it takes time. One has to hew a path through
the blood, through the humours, up to the brain, and, once there,
create the Passion of Admiration. How can it be done at once?’
‘I can’t wait ... I can’t wait ... except things come at once I’ll have
none of them ... at least that’s not quite my meaning,’ she added
hurriedly, looking furtively round and crossing herself several times.
‘Oh! but I don’t feel that I am of a humour that can wait.... Oh! I
feel something sick and weak in me somewhere.’
‘It’s but those knavish old animal spirits playing tricks on the will,
but I think that it is only because one is young,’ and he would have
launched out on a philosophical dissertation, only Madeleine felt that
she could not stand it.
‘Don’t, Jacques!’ she screamed. ‘Talk about me, or I shall go mad!’
‘Well, then, recount to me the whole matter.’
‘Oh! there is nothing worth the telling, but they would make
dædal pleasantries—pleasantries one fails to understand, except one
have a clue—and they would talk about people with whom I was not
acquainted.... Oh! it seems past human compassing to make friends
with a person except one has known them all one’s life! How could I
utter my conceit if they would converse of matters I did not
understand?’ she repeated furiously. Jacques smiled.
‘I admit,’ he said dryly, ‘to be show man of a troupe of marionettes
is an agreeable profession.’ She looked at him suspiciously for a
second, and then catching his hands, cried desperately:—
‘Is it beyond our powers ever to make a new friend?’
‘That it is not, but it can’t be effected at once. I am sure that
those Messieurs de Port-Royal would tell you that even Jesus Christ
finds ’tis but a slow business worming His way into a person’s heart.
There He stands, knocking and knocking, and then——’ Madeleine
saw that he was on the point of becoming profane, and as her gods
did not like profanity, she crossed herself and cut in with:—
‘But even admitting one can’t come to any degree of intimacy with
a person at once, the beginning of the intimacy must happen at
once, and I’m at a loss to know how the beginning can happen at
once any more than the whole thing.’
She had got into one of her tight knots of nerves, when she
craved to be reasoned with, if only for the satisfaction of
confounding the reasons offered her. Jacques clasped his head and
laughed.

You might also like