100% found this document useful (3 votes)
49 views

Full Download Codeless Data Structures and Algorithms: Learn DSA Without Writing A Single Line of Code Armstrong Subero PDF

Codeless

Uploaded by

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

Full Download Codeless Data Structures and Algorithms: Learn DSA Without Writing A Single Line of Code Armstrong Subero PDF

Codeless

Uploaded by

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

Download the full version of the textbook now at textbookfull.

com

Codeless Data Structures and Algorithms:


Learn DSA Without Writing a Single Line of
Code Armstrong Subero

https://textbookfull.com/product/codeless-data-
structures-and-algorithms-learn-dsa-without-
writing-a-single-line-of-code-armstrong-subero/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Learning functional data structures and algorithms learn


functional data structures and algorithms for your
applications and bring their benefits to your work now
Khot
https://textbookfull.com/product/learning-functional-data-structures-
and-algorithms-learn-functional-data-structures-and-algorithms-for-
your-applications-and-bring-their-benefits-to-your-work-now-khot/
textbookfull.com

Learning Functional Data Structures and Algorithms Learn


functional data structures and algorithms for your
applications and bring their benefits to your work now 1st
Edition Atul S. Khot
https://textbookfull.com/product/learning-functional-data-structures-
and-algorithms-learn-functional-data-structures-and-algorithms-for-
your-applications-and-bring-their-benefits-to-your-work-now-1st-
edition-atul-s-khot/
textbookfull.com

Programming PIC Microcontrollers with XC8 1st Edition


Armstrong Subero

https://textbookfull.com/product/programming-pic-microcontrollers-
with-xc8-1st-edition-armstrong-subero/

textbookfull.com

Mexico : what everyone needs to know Second Edition


Roderic Ai Camp

https://textbookfull.com/product/mexico-what-everyone-needs-to-know-
second-edition-roderic-ai-camp/

textbookfull.com
Multiscale Solid Mechanics: Strength, Durability, and
Dynamics Holm Altenbach

https://textbookfull.com/product/multiscale-solid-mechanics-strength-
durability-and-dynamics-holm-altenbach/

textbookfull.com

Maritime Governance: Speed, Flow, Form Process 1st Edition


Michael Roe (Auth.)

https://textbookfull.com/product/maritime-governance-speed-flow-form-
process-1st-edition-michael-roe-auth/

textbookfull.com

JavaFX 9 by Example Dea

https://textbookfull.com/product/javafx-9-by-example-dea/

textbookfull.com

The Oxford Handbook of Music Censorship Oxford Handbooks


Patricia Hall (Ed.)

https://textbookfull.com/product/the-oxford-handbook-of-music-
censorship-oxford-handbooks-patricia-hall-ed/

textbookfull.com

Armies of Deliverance: A New History of the Civil War


Elizabeth R. Varon

https://textbookfull.com/product/armies-of-deliverance-a-new-history-
of-the-civil-war-elizabeth-r-varon/

textbookfull.com
Gastroparesis A Comprehensive Approach to Evaluation and
Management Anna Ibele

https://textbookfull.com/product/gastroparesis-a-comprehensive-
approach-to-evaluation-and-management-anna-ibele/

textbookfull.com
Armstrong Subero

Codeless Data Structures and


Algorithms
Learn DSA Without Writing a Single Line of Code
Armstrong Subero
Basse Terre, Moruga, Trinidad and Tobago

Any source code or other supplementary material referenced by the


author in this book is available to readers on GitHub via the book’s
product page, located at www.​apress.​com/​9781484257241 . For more
detailed information, please visit www.​apress.​com/​source-code .

ISBN 978-1-4842-5724-1 e-ISBN 978-1-4842-5725-8


https://doi.org/10.1007/978-1-4842-5725-8

© Armstrong Subero 2020

This work is subject to copyright. All rights are reserved by the


Publisher, whether the whole or part of the material is concerned,
specifically the rights of translation, reprinting, reuse of illustrations,
recitation, broadcasting, reproduction on microfilms or in any other
physical way, and transmission or information storage and retrieval,
electronic adaptation, computer software, or by similar or dissimilar
methodology now known or hereafter developed.

Trademarked names, logos, and images may appear in this book. Rather
than use a trademark symbol with every occurrence of a trademarked
name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark. The use in this publication
of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of
opinion as to whether or not they are subject to proprietary rights.

While the advice and information in this book are believed to be true
and accurate at the date of publication, neither the authors nor the
editors nor the publisher can accept any legal responsibility for any
errors or omissions that may be made. The publisher makes no
warranty, express or implied, with respect to the material contained
herein.

Distributed to the book trade worldwide by Springer Science+Business


Media New York, 1 New York Plaza, New York, NY 100043. Phone 1-
800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-
sbm.com, or visit www.springeronline.com. Apress Media, LLC is a
California LLC and the sole member (owner) is Springer Science +
Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a
Delaware corporation.
To all those who tinker to keep the world running.
Introduction
There is one question beginners and even good self-taught developers
ask me all the time: “How do I learn data structures and algorithms?” I
have had to answer this question so often that I thought I would write it
down in a book so that anyone interested in this topic could follow
along and understand the process.
The thing is, anyone can learn the basics of data structures and
algorithms. There really isn’t much to them. The hardest part of
teaching someone this topic is that they are likely to be using any
language from the current “zoo” of languages. They may be using
Python, Java, C++, or even C or Rust. Whatever the language they are
using, it is important to be able to understand data structures and
algorithms at the fundamental level. As such, I decided to make my
book “codeless.” This is a book on algorithms and data structures that
doesn’t use a single line of code from any programming language.
As someone who must regularly change between different
programing languages, take it from me, once you understand the
concepts behind these algorithms in a codeless way, then you will be
able to apply them to whatever language you are using.
There are also some people “devout” in their programming
language who are unwilling to look at any material that isn’t in their
language of choice. As such, I have written this book without offending
anyone’s “beliefs.” I think there are enough books on “data structures
and algorithms in X language” that are thousands of pages detailing
programs and all their nuances for the language you are using. I think
such books would be fine complements to this one, as this book will
give you the “big picture,” and then you can look at whatever book you
want for the rest. You can learn about a concept here and then go to
that book to learn the programming details.
Everything is explained in plain English, and each chapter is short
and to the point. You will learn a lot without burning your brain out.
Who Is This Book For?
This book is for people who want to understand data structures and
algorithms but don’t want unnecessary details about quirks of a
language and don’t have time to sit and read a massive tome on the
subject. This book is for people who want to understand the concepts of
algorithms and data structures in plain English. I assume, though, that
you have knowledge of at least one programming language, preferably a
C-based one such as C, C++, Java, C#, or Python. The types and
terminology used in this book are biased toward people who have used
one of these languages.
I assume you are good at thinking abstractly and at least have basic
knowledge of a programming language and of the basics of computer
science (what a bit is, what a byte is, etc.). I also assume you know basic
mathematics, at least algebra, though this book is by no means a “math-
heavy” book. I use math concepts only where they are necessary and
explain them clearly.

What Will I Need for This Book?


You won’t need anything except an open mind and time to read and
understand the concepts being presented. I wrote this book as if we
were having a coffee and I was explaining these concepts to you from
the top of my head. For that reason, you won’t need any compiler or text
editor, just a listening ear.

What Will I Learn in This Book?


You will learn quite a lot in a short space of time about data structures
and algorithms. You will learn the concepts of data structures and
algorithms with a focus on the most relevant ones in simple, plain
language. After completing this book, you’ll understand which data
structures and algorithms can be used to solve which problems and will
be able to confidently follow along with discussions involving
algorithms and data structures.
PART I – Data Structures
Chapter 1 goes into what algorithms and data structures are, and
we discuss primitive types and Big O notation.
Chapter 2 looks at the linear data structures of arrays and linked
lists; we also discuss stacks and queues.
Chapter 3 delves into trees and tree-based data structures.
Chapter 4 introduces you to hash-type data structures.
Chapter 5 briefly covers the basics of graphs.
PART II – Algorithms
Chapter 6 introduces two common algorithms, that of linear search
and binary search.
Chapter 7 explores sorting algorithms, including bubble sort,
selection sort, insertion sort, merge sort, and quick sort.
Chapter 8 presents some search algorithms; we look at breath-first
search, Dijkstra’s algorithm, and the A∗ algorithm.
Chapter 9 introduces clustering algorithms, specifically the K-
means algorithm and K-nearest neighbor and get a taste of machine
learning and neural networks.
Chapter 10 teaches some basics about the concept of randomness.
Appendix A provides resources for going further.
Upon finishing this book, you will have a solid foundation in
algorithms and data structures and will be able to use this knowledge
when writing and designing your own programs.

Errata and Suggestions


If you find any errors in this text, have suggestions, or want to ask a
question about your own project, you can contact me
atarmstrongsubero@gmail.com ; please, no spam.
Acknowledgments
I want to thank my family.
I want to thankeveryone who ever said anything positive to me or
taught me something. I heard it all, and it meant something.
I want to thank God most of all, because without God I wouldn’t be
able to do any of this.
Contents
Part I: Data Structures
Chapter 1:​Intro to DSA, Types, and Big O
Chapter 2:​Linear Data Structures
Chapter 3:​Tree Data Structures
Chapter 4:​Hash Data Structures
Chapter 5:​Graphs
Part II: Algorithms
Chapter 6:​Linear and Binary Search
Chapter 7:​Sorting Algorithms
Chapter 8:​Searching Algorithms
Chapter 9:​Clustering Algorithms
Chapter 10:​Randomness
Chapter 11:​Scheduling Algorithms
Chapter 12:​Algorithm Planning and Design
Appendix A:​Going Further
Index
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
About the Author
Armstrong Subero
started learning electronics at the age of
8. From then on he got into
programming and embedded systems
development. Within the realm of
programming, he has a special interest in
algorithms and data structures and
enjoys implementing them in different
programming languages and on different
processor architectures, particularly
resource-constrained systems. He
currently works at the Ministry of
National Security in his country, and he
has degrees in computer science and
liberal arts and sciences from Thomas Edison State University. He is the
author ofProgramming PIC Microcontrollers with XC8 (Apress, 2018).
Part I
Data Structures
© Armstrong Subero 2020
A. Subero, Codeless Data Structures and Algorithms
https://doi.org/10.1007/978-1-4842-5725-8_1

1. Intro to DSA, Types, and Big O


Armstrong Subero1
(1) Basse Terre, Moruga, Trinidad and Tobago

Every journey has a beginning. In this chapter, we will begin our


journey by talking about what data structures and algorithms are. I will
introduce basic types, and I will show you how easy Big O notation is to
understand. If you have ever read a dull, overly complex book on data
structures and algorithms (abbreviated to DSA), you will love how
quickly this chapter teaches you things!

An Overview of Data Structures and Algorithms


“Talk is cheap. Show me the code.”
—Linus Torvalds, Finnish software engineer and creator of
Linux

Linus said this while replying on the Linux Kernel mailing list on
August 25, 2000. This reply has become a famous quote among
programmers. It is used by developers whenever they don’t want to
read anything and instead just jump into coding. This approach is
particularly taken by novices and poorly self-taught programmers.
They don’t plan, they think they know more than everyone, and they
think programming is all about the code. This couldn’t be further from
the truth. Code simply expresses your thoughts to solve a problem.
Nothing more. Therefore, the more you know, the more you can apply
to solve a problem.
Data structures and algorithms are simply more things to know to
apply to solve your problems. Despite some people using them
interchangeably, data structures and algorithms are actually very
different things. It is possible to learn data structures and algorithms
without touching a programming language. Programming essentially
consists of thinking algorithmically and knowing the syntax of the
programming language to solve problems. In this book, we will focus on
thinking algorithmically and avoid learning the syntax of any
programming language.
Before we discuss data structures and algorithms, I think we should
talk a little about data. Data can mean different things depending on the
discipline you are currently occupied with. However, data within the
context of this book refers to any information that is stored on your
machine or that is being handled or processed by it. Data should not be
confused with information, which is data that has been processed;
however, within the context of computing, many developers may use
these terms independently to mean the same thing.

Data Structures
A data structure is a concept we use to describe ways to organize and
store types of data. Data structures are important because they not only
provide a way of storing and organizing data but also provide a way of
identifying data within the structure; additionally, they show the
relationships of the data within the structure. It is best to illustrate
what a data structure is with an example.
For example, let’s say we have some footwear, as depicted in Figure
1-1. We have two boots and two shoes arranged alternately.

Figure 1-1. Two types of footwear

We can think of each side of the shoe as a unit of data. If we needed


a way to maintain this data arrangement, we would need a mechanism
to provide some ordering and identification of these shoes; this is what
we may call a data structure. A data structure may provide some
mechanism to organize and store this data, for example, by separating
boots and shoes as shown in Figure 1-2.

Figure 1-2. Separating boots and shoes


A data structure may also be able to take each item and, regardless
of whether it’s a shoe or boot, assign an identifier, for example, a
number as shown in Figure 1-3.

Figure 1-3. Assigning identifiers

So, if I wanted the “second shoe,” instead of wondering if this means


from the left or from the right, I can simply tell the data structure, “Give
me the shoe at index 2,” and I will get exactly what I wanted.
As basic as it may seem, this is all a data structure does, though
there are much more complex methods of storing, identifying, and
showing the relationships within data. This explanation provides a
good grasp of what a data structure does. If you still aren’t clear what a
data structure is, it is best to think of a data structure as a container for
data.

Algorithms
An algorithm is a method of solving a problem by applying a sequence
of steps that will always work to solve the type of problem it was
designed to solve. Another way of saying this is that an algorithm is
simply a method of solving a problem in an ordered manner. We can
even shorten it further to say an algorithm is a procedure. Many people
may have expanded or diminished perspectives to describe what an
algorithm is, but this definition will work for our understanding.
One thing everyone will agree on is that algorithms are logical steps
to accomplish a task. To accomplish this, an algorithm must be simple,
precise, and unambiguous. Though some programmers focus on using
esoteric features of programming languages that make an algorithm
hard to read for other programmers, the simpler and more intuitive an
algorithm is, the more powerful and useful it will be.
We can describe algorithms with natural languages such as English,
pseudocode, or a programming language. We can discuss algorithms at
great length; however, it is best to see how algorithms work with a good
example. In our example, we can show how algorithms operate with a
pure English description, with no code needed.
We can gain an understanding of algorithms by looking at one in
action. Let’s say you need to put some fruit on a plate. You would, of
course, grab a plate and put some fruit on it, right? Well, imagine you
were describing these same steps to a robot. How would you do it? You
would tell the robot to do something like the following:
1. Go to the cupboard.

2. Open the door.

3. Take out a plate.


4. Go to the fruit bowl.

5. Put the fruit on the plate.

This seems like a logical sequence of steps, until you look around
the kitchen and realize that the robot left the cupboard door open. So,
you decide to add another step to the algorithm, as shown here:
1. Go to the cupboard.

2. Open the door.

3. Take out a plate.

4. Close the cupboard door.

5. Go to the fruit bowl.

6. Put the fruit on the plate.

You watch the robot run through the new steps, only to realize that
the robot is stuck at step 6, unable to put any fruit on the plate because
the fruit bowl has a tomato and the robot doesn’t know if a tomato is a
fruit or a vegetable. This is where data structures come into play for
working with algorithms.

Algorithms and Data Structures in Tandem


Data structures and algorithms are separate but complementary to
each other. We can say that data structures organize data that
algorithms work upon. Data structures provide the fragments that
algorithms take in, process, and output into whole information that the
end user wants to derive.
Let’s look at the problem we arrived at in the previous section when
we wanted our robot to place fruit on a plate. While our algorithm
seemed sound, because of a simple classification problem, our robot
became stuck. One solution to this is to tell the robot that if the item is
part of a plant, it is a vegetable, and if the item is formed from the
mature ovary of a seed, then it is a fruit. The robot may become
confused here because that is too much information to process. We
must define what a plant is, what a seed is, what an ovary is, and what a
vegetable is, which makes our algorithm more complex.
Another, simpler way to do this is to have a data structure that
organizes images with all the fruit the robot is likely to encounter and
perform a check to see whether the item belongs to a member of that
structure. If it is a member, the robot places it on the plate; otherwise,
the robot skips that item. If the item is in between, then the robot will
place it if it shares more characteristics with other fruits than not. This
“grouping if lots of characteristics are shared” is part of a later
algorithm for classification we will discuss in Chapter 9 on clustering
algorithms.

Primitive Types
In the previous section, we talked about data structures and algorithms.
We said that a data structure stores and organizes data that algorithms
then process to get some output. We also said that data is information
stored on your machine or that is being processed by it. What we didn’t
say is that this data can be of different types.
Data needs to be of different types because a computer is a very
specific device. We have all heard the phrase “garbage in garbage out”
(GIGO) . This term gives us only part of the picture. We must realize that
a computer is an input-output device, yes, but it is also a device that
performs processing on data before it is output. This means we can put
good data in and still get garbage out.
This can happen in two ways. The most obvious way is that the
computer will perform an error in the processing of the problem (our
algorithm is bad). The other way is that if we fail to tell the computer
what type of data it is working on, then it will not know what to do and
will still output garbage. This will occur even if our algorithm is good,
as the algorithm is expecting data of a certain type.
This seems so simple, yet it is so important. In fact, it is so primitive
that we have a name for telling the computer what type of data types
we are working on. We call this the primitive data type.
A data type will tell our machine the attributes of the data we are
using and what we intend to do with the data. There are many data
types in computing, but the primitive data type is the most basic type
there is in your programming language of choice. It is so basic that it
usually forms part of the language itself and is usually built into the
language.
From these primitive languages, we get other data types. Though
most programming languages will have their own names for the data
types, they all fall into one of the following from the C-based languages.
I call them the “Big Four” because from these big four cornerstones,
everything else is built upon.
Sometimes these data types are also called atomic data types simply
because you cannot divide them into a lower-level type; they are as low
as a data type can get.
These are the four types of primitive data types:
Boolean
Character
Integer
Floating-point number
These four basic data structures tell your computer what type of
data you are working on. Let’s look at each of them in detail now and
get a good understanding of what they are.

Boolean
The Boolean primitive data type is the first one we will look at. The
Boolean type is known as a logical data type, having two possible
values: True and False, 0 and 1, or ON and OFF.
At the heart of classical computing is the Boolean data type.
Classical computers have a processor that consists of millions of
transistors that turn on or off. Based on them being on or off, we get all
sorts of amazing operations, storage, and all the mechanisms you can
think about in classical computing. The binary running in the
arithmetic logic unit (ALU) and the instruction register consists of
simply 0s and 1s. The concept of ON and OFF is so powerful that it
translates into basically all programming languages in one form or
another.
While it is not necessarily pertinent to our discussion on the
Boolean data type, it is handy to know that in the realm of quantum
computing there exists quantum bits called qubits . While in the realm
of classical computing the “hard on” and “hard off” Boolean type is
standard, quantum computers have qubits that are neither 0 nor 1 but
are in a state of superposition having both states simultaneously.

Character
The next item on our list is the character . Classical computers work on
binary bits of information and prefer to crunch numbers. Humans, on
the other hand, prefer to work with the natural language of their choice.
This is where characters come in.
Us humans find it difficult to remember data by its binary sequence
of representation. As such, characters can be used to give us a more
understandable and easier-to-remember version of this sequence of
binary bits. When we combine this sequence of characters into strings,
it makes this much better. For example, the variable cat is more
readable, recognizable, and memorable written as cat than as
01100011 01100001 01110100. Characters are used to make up
strings and have differing encodings depending on the machine you are
using.

Integer
The computer is all about numbers, and no data type is better fit to
represent numbers than the integer. An integer refers to a
mathematical number that does not have any fractional constituent, for
example, 6 or 7.
The only distinction between integers in mathematics and integers
in computer science is that in mathematics integers, unless they belong
to a finite subset, are infinite. In computing, because of limitations in
processor architecture and memory, integers are not infinite.
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Floating-Point Number
The floating-point number can be thought of as an integer with a
fractional constituent. This is the type of number that people refer to as
decimals, for example, 6.5 or 7.1. They are called floating point because
the little dot (.) called the radix point can float, or move, to accurately
represent the number we are displaying.
Floating-point numbers are usually described as either single
precision or double precision. Single-precision floating-point numbers
are represented with a 32-bit word, whereas double-precision numbers
are represented by a 64-bit word. Usually single-precision floating-
point numbers are called floats, and double-precision floating-point
numbers are called doubles . There are also floating-point numbers that
require 128-bit word representations that are called decimals .

Functions
Before we go further, I would like to take a moment to discuss an
important mathematical concept that is intertwined with computer
science, that of the function. Note that the mathematical function we
are discussing shouldn’t be confused with functions in programming,
which refer to a section of code that performs some task.
In mathematics, a function is an expression that maps an
independent variable to a dependent variable.
We call the input to the function the domain, and we call the output
the range. Each domain element can be mapped to one, and only one,
element in the range. The function determines which element at the
domain gets mapped to which at the range.
In Figure 1-4 we have a function that matches numbers on the
domain with letters in the range.
Figure 1-4. Mathematical function
The function can be visualized as a black box that takes an input,
does some processing, and gives an output (kind of sounds like a
computer, doesn’t it?). Look at Figure 1-5 to see the essence of what a
function is.

Figure 1-5. Essence of a function

Even though earlier it was mentioned that a mathematical function


shouldn’t be confused with a function in programming, in programming
when we talk about a function, we talk about a routine or procedure.
Some functions in programming are identical to the functions in
mathematics in the sense that they take some input parameter, do some
processing on it, and then return a value. This simple concept is
important to understand, as you will see moving forward.

Functions, Methods, Procedures, and Subroutines


This book takes a codeless approach to teaching you data structures
and algorithms; however, there is some lingo from programming
languages that you need to be familiar with as some terms will come up
in our discussion of algorithms in later chapters. These are functions,
methods, procedures, and subroutines.
It is best to begin our discussion on functions by relating it to
something we are familiar with like a house. When we are building a
house, we use bricks to gradually build it up; some people call these
bricks blocks. Now you can think of a program like a large house made
of many building blocks. A group of blocks can be combined to make a
wall or a room. According to how you configure the blocks, you can
have a wall that has a window or a wall that does not have a window.
Within the realm of construction, it is not possible to save a
configuration of bricks as a wall with or without a window and simply
replicate it to build our house because actual people must assemble the
wall. However, when building software, it is possible to save an
arrangement of a block of code that solves a task and use it many times
over. We call this bit of code a function.
This function is like the mathematical function we spoke of in the
previous section; however, it is not the same. Functions in
programming languages take data as an input that we call parameters
or arguments, and sometimes they return a result. I say sometimes
because unlike mathematical functions that give an output based on an
input, functions sometimes do not return any result, which is called a
void function in C-based programming languages.
Some programming languages are called object-oriented
programming (OOP) languages and within them exists special code that
are blueprints for other code. We call this code that acts as a blueprint a
class. When functions exist inside of a class, we call them methods.
Essentially, methods are functions called by that name in discussions
about OOP languages.
Some programming languages may call a function a procedure or a
subroutine ; you should know, though, that some programmers refer to
functions that do not return a value as procedures as well.
Functions, methods, procedures, and subroutines all mean the same
thing and serve the same purpose; it depends on the language you are
using and sometimes who you are speaking to. They are all small
programs, or subprograms rather, that can be called within a larger
program.
Recursion and Iteration
Before we go further with our discussion on algorithms, I think we
should look at the concepts of recursion and iteration. Recursion is a
tricky thing to understand. Let’s imagine you hear a new word such as
thingamaword and you don’t know what it means. You turn to the
dictionary only to see the following definition:
thingamaword. see thingamaword.
Such a definition would make no sense, as the meaning refers to
itself. This is what recursion is; it is the process of something being
defined in terms of itself. Within the context of programming, a
recursive function is one that calls itself as part of its operation. To end
the cycle of a function calling itself, usually a recursive function runs
until a certain condition is met.
If the recursive function calls itself too much, then due to a machine
having finite memory, the machine will run out of memory, and you
may get what is known as a stack overflow error due to the maximum
recursion depth being exceeded.
Recursion finds many uses in programming languages, and many
algorithms are in fact dependent on recursion to operate. We will see
examples of such algorithms as we work throughout the book.
Iteration is another term that you hear quite often that should not
be confused with recursion. Iteration within algorithms refers to the
process whereby a block of code sequence is repeated until a certain
condition specified by the program designer is met.
For example, let’s say we are entering a password into a system. The
program can be designed in such a way that the user will enter the
password a fixed number of times until the correct password is entered.
An iterative function can be the heart of the program in that the user
will be given three times to enter the password, and if the three times
are exceeded, then the user will be locked out of the program.
In such a scenario, the iteration is the block of code being executed
three times, and the specified conditions for exiting the iterative
sequence are the correct password being entered within three tries and
the user entering the wrong password.
Iteration finds extensive use in the execution of algorithms and
within general programming as well. One thing that should be
mentioned about iteration, though, is that, like recursion, if you do not
specify an exit condition due to a computer having finite memory, you
will get errors in the program.
Many algorithms can use either recursion or iteration to solve the
problems they are designed for; however, it depends on the algorithm
designer to choose which method is best.

The Three Types of Algorithms


In ending our introduction on data structures and algorithms, I think
it’s best if we discuss the three types of algorithms. Within the context
of algorithm types there are three basic approaches to solving a
problem. These three approaches are dividing and conquer, greedy, and
dynamic.
Divide-and-conquer algorithms take a large problem, divide it into
many smaller problems, and then combine the results to obtain a
solution. Think about ants harvesting leaves from a tree. If the goal of
the ants is to strip the tree of all its leaves, this is a daunting task for any
single ant regardless of how hard it works.
A tree is many times larger than an ant; however, if thousands of
ants each attack a single leaf, then they would be able to solve the
problem of stripping the tree of its leaves. Some large problems within
computing require this type of approach to solve a problem.
Greedy algorithms are algorithms that take the best decision at any
point in time. Imagine a superhero having a choice to make between
catching the bad guy who is escaping or rescuing the damsel who is
about to face impending doom. This requires decisive action, and the
superhero will make the choice he thinks is best at that point in time.
Similarly, greedy algorithms will do what is best at the point in time
at which the algorithm is executing, whether it has the best overall
impact to solve the problem at hand or not. Some problems require this
type of algorithm to solve. One of the most popular is the traveling
salesperson problem. This problem is one of the most important in
computer science.
Random documents with unrelated
content Scribd suggests to you:
office. You’ve never been here in July. It’s awful. I’ll let you know
later when I shall be coming; time of train, etc.
“You were missed at The Lawn last night. I took a man who lives
near to share my solitary meal there, and to have a game of billiards
afterwards. He wanted me to try over ‘Ford of Kabul River’ for him; I
can’t accompany myself, though, and he made an awful hash of it. I
wished we’d dined in town and gone to a show.
“When I go out to lunch I shall call at Fuller’s and order them to
send you on—for the look of the thing—a box of chocolates. I hope
they have one with a picture of forget-me-nots or something of the
sort on the lid,”

(Yes; they had. White satin, with the sprays of flowers


embroidered in pale blue silk.)

“as Theo notices everything. Don’t let her bag all the sweets,
though.”

(Here the writing gets more scrawly and hurried.)

“Have just got in from lunch, which I had with my uncle. He was
full of talk; you can imagine it!”

(I can.)

“I also saw two other men whom I’d got to meet, and as a result
of this, I think I’ve managed to get through the business that was
keeping me. So I shall be down at the end of the week after all;
cheers for some fresh air and a dip! Please be very glad to see me,
will you? as Theo—but I put that before.
“Just before I went out to lunch a very rum thing happened: at
least, I thought it was rum until I found out what it was. I was
opening the door of my room when I heard, in the passage, your
voice, Nancy! Yes, your voice, with that little dare-devil tone you put
on sometimes, saying these extraordinary words: ‘I think it’s to the
Savoy that I’m going out with Mr. Waters to-day!’
“I couldn’t think what on earth was the meaning of it, with you
miles away in Anglesey.”

(But already I smiled, seeing what was coming!)

“I wondered what could have brought you back, or if I’d got an


hallucination—can you hear hallucinations?—and I bolted out into
the passage, nearly knocking over two of the typists who were
coming down it.
“Miss Smith (that’s the one whose affections are otherwise
engaged, isn’t it?) fled like a hare; but that tall, dark Miss Robinson
stood her ground, only moving aside a little for me to pass. I
stopped and asked her straight out, ‘Was it you who were speaking
a moment ago?’
“She said ‘Yes’—all meekness at once. ‘Mimicking hussy’ I thought
—for it really had been exactly the way I’ve heard you speak, you
know, sometimes. It was all I could do to keep from laughing
outright, but I just said ‘Well, I am writing to Miss Trant to-day; can
I give her any message from you?’
“And she said (in that ‘mim’ voice, which I’m blest if I shall ever
feel able to believe in again!) ‘Will you please give her my love, Mr.
Waters?’
“So with love from Miss Robinson, I remain,
“Your
“Billy.”

(What’s this? “Your” Billy? It can’t be. Oh, no. It’s his disgraceful
handwriting. It’s the “r” being scrawled into the “s” like that. “Yours,
Billy,” is how it really reads. How stupid of me not to see that at
once! Then there’s a bit across the top.)

“Six-forty train Porth Cariad on Saturday. You might write and tell
me how you do like the place; and you might answer at once, even
if it’s only for the girls to take it to the post.”

So, for the benefit of Blanche and Theo, I will write at once; I’ll do
it out here, in pencil on my pad, as I’ve so often taken down his own
letters. (One of these days I shall tell him how I loathed it, and how
utterly impossible his dictation was!)

“Porth Cariad. July —, 1913.


“Dear Sir,
“Your favour of yesterday’s date to hand, for which we thank you.”

(There! I wonder how he’ll like that. Will he think that it goes on
all through?)

“The lovely sweets really were appreciated; but I didn’t let Theo
bag them all, nor take the pale-blue satin tie-up to make a bow for
Cariad, which was what she wanted to do. So then she said of
course Nancy would want to keep that ribbon to tie round all your
letters. She does notice everything, doesn’t she?
“As for how I like this place, I simply love it, and the cottages—I’m
in the bigger one with your mother, and Theo and Blanche are
together in the other until you come—and I love the sand-hills with
the sea-holly and little prickly brambly roses and tiny purple pansies
growing all over them,”

(I might slip a pansy from this place that he’s fond of into the
envelope? No, I mightn’t. There’s no Theo to “notice” at his end.)
“and the cloud shadows on those hills opposite, and Mrs. Roberts,
with her sackcloth cooking-apron and her clogs and the boy’s cap
she wears; and Blodwen, even if all the English they know does
always seem to be all about you! And I should hate a pier-concert if
there was one. There’s everything here to make me quite happy.
Since this very hot weather’s come, the bathing is delicious. I
learned to swim when I was a little girl, thank you.”

(So he needn’t think he can teach me anything.)

“How was Mr. Albert Waters? Still chuckling and laughing ‘ho, ho!’
I expect.
“I laughed at your being taken in like that by Miss Robinson.
Yesterday morning I was almost taken in, by something that was like
you: a sharp tap against my bedroom window that might have been
a stone thrown up. But it was only a fat, speckly thrush cracking a
snail; there are always lots of them crawling out of that
southernwood bush by the door.
“Mrs. Roberts asks me to tell you,”

(What she said, in her speciously honeyed Welsh voice and with
her irresistible if toothless smile, was, “Tell your Cariad——” But I
needn’t put that.)

“that the ’ooden ’ooman—it took me some time to remember that


this was the figure-head on the cliff!—was want paint very bad, and
she wonder would you do it when you come. Welsh people, I notice,
are fond of ‘wondering’ like this, instead of asking straight out for
what they want; yet they generally seem to get it.”

(Dear me, this is rather different from the blank sheet I might
have enclosed.... Anyhow, it mustn’t get any longer than his, so I’d
better stop now.)
“I will give this to Theo to post, and”

(Goodness, it is difficult to think of how to sign oneself to young


men. To Sydney I was always “Yours sincerely.” A stupid ending,
means nothing at all.)

“With kind regards.”

(No.)

“Assuring you always of my best attention,”

(No. A bit of that at the beginning was enough.)

“Will give this to Theo to post, and I am,”

(Well! What I am, after all!)

“Your official fiancée,


“Monica Trant.”

Ah! Now there’s something I’d forgotten!

“P. S. I will remember what you’ve ordered—”

(No, that sounds rather nasty; rather too like Manner B. Cross it
out.)

—“what you—wish”? No! “What you suggest about my being


pleased to see you on Saturday.
“N.”
As a matter of fact—I shan’t write it, as it might possibly give a
wrong impression!—but I really shall be quite pleased to see Billy
Waters again. And now to find his young sister, and send her off to
the post with what she, in her innocence, imagines to be a return
love-letter!
CHAPTER XXII
THE WOODEN WOMAN

If a girl were the least bit inclined to fall in love with Billy Waters—
and I see now that some girls might be; though not, of course, any
girl of my type, capable of this kind of frank friendship that puts
anything else out of the question!—well, if she were, she’d find it
much easier to complete the process here at Porth Cariad than
anywhere else that I can imagine him.
Some men—generally the nicest—are so much more themselves in
the depths of the country. He is.
I noticed that the very first evening he arrived here, when I went
down to meet him—to keep up appearances before his family—at
this tiny station on the branch line. Before the train stopped I saw
his head and shoulders blocking up the open window of his
compartment in his hurry to arrive. Catching sight of me on the
platform, he took the pipe from between his strong white teeth and
flourished it over his head in greeting—his face one broad smile
because his holiday had begun; then the train slowed down; he was
out of the carriage door and taking a running stride towards me.
“Hullo, Nancy!” he said, and grasped my hands. “You came? I
wondered if you would. It’s very—appropriate of you. How are you?
You look very fit. A sun-bonnet, eh?”—It was a haymaker’s cotton
one, that I’d bought for a shilling and a ha’penny at the post office,
and rather becoming—“I’ve never seen you in a pink sun-bonnet
before.”
“You wouldn’t be likely to in Leadenhall Street,” I retorted. “How’s
the dear office?”
“I don’t know or care. I’m here to forget it,” he said gaily as we
left the station for the road between the sand-hills. “I think I shall
take to wearing a sun-bonnet myself!”

But what he wears here is just a soft white shirt with a turn-down
collar and a pair of loose grey flannel bags belted at the waist; no
hat at all—his hair has got to look as if it must be permanently
rumpled; no one from the office would recognize him! Even his eyes
seem a different colour; so much warmer and bluer for the
deepening of his tan. He drops a year a day from his age, too. When
one sees him striding about these sandy lanes, or terrifying his
mother by those efforts to walk on his hands in six foot of water in
the bay, or when he’s pretending to jabber back Welsh to Mrs.
Roberts and Blodwen, who openly adore him—yes, I can imagine
quite a number of people finding him positively attractive here in the
country.
In the country, too, as I’ve always heard, it’s so much easier to fall
in love than it is in town. Town, with its rush and racket and roar,
seems to insist that the things that really matter are getting on and
making money—or even the bare living for which half these grimy
crowds are struggling and toiling! But the country!—that has a way
of suggesting itself as a series of lovely backgrounds for a grouping
of Two, and of coaxing home the idea that all that matters is Love.
To a falling-in-love kind of person the country here would seem as
bad as Hamlet for being “so full of quotations” from every poet who
ever wrote about trysts, and gathering rosebuds, and loves in
valleys, and foolish, pretty nonsense of that sort. They’d be
reminded of it by every dance of a pair of blue butterflies over the
dunes; every spread of the rosy arms of sea-anemones in the pool
towards the incoming wave; and as for these other waves of scented
gold that are poured over all the waste ground hereabouts——
“It’s a blessing there’s such a lot of it out just now!” as Theo
remarked this morning at breakfast. “I suppose engaged people
would want to be where there was plenty of gorse!”
Whereat her brother and I exchanged glances, across the table, of
amused intelligence. For it’s all very well for this child to think she
can “chip” us with that old tag about kissing and the gorse in bloom.
We’ve only got to remember how little she suspects that the only
kiss between us is that “duty good night” one of Uncle Albert’s visit,
and the laugh is all on our side!

“You needn’t laugh, Billy,” Theo added. “You know you’re really
frightfully cross because you won’t be able to get Nancy all to
yourself this afternoon, with these people coming!”
It was the first I’d heard of any visitors, for I’d come down rather
late that morning. I hadn’t slept as well as I usually do. Outside the
window of my little sloping-ceilinged cottage bedroom the water, at
high tide, had seemed to make rather more noise than its usual soft
lap-lapping against the rocks. And then the moon, rising like a big
round primrose-coloured Chinese lantern in the star-sprinkled purple
sky over the Rivals on the other side of the Menai Straits, had
poured a flood of white radiance straight upon my bed, and I hadn’t
bothered to get up and pull down the yellow linen blind to shut it
out. I had wanted to feel the sea-scented night-breeze across my
face. So I had lain there, tossing a little between the snowy rough
country sheets, watching the square of light creeping inch by inch up
the wall, and thinking idly of all sorts of irrelevant things....
Of Cicely in Marconi Mansions....
Of “Smithie” at the office, and her boy. They didn’t prove much
truth in the theory that people fall more deeply in love in the
country. I saw again that crossing at the Bank, with the big motor-
buses skidding across the muddy road like beginners on skates; and
there, in the middle of the fog and the petrol-reek and the jostling
luncheon-hour crowds, those two anæmic, City-fied young faces
shone as radiantly as if the lovers walked the loneliest Eden that
ever was....
Of a school-friend of my own, now very happily married, who had
said to me, long ago: “An engagement, Monica, is such a skimpy
time! It’s made up of nothing but good-byes and good nights to the
person you most want to be always with!”
And of the difference between that sort of engagement and the
“arrangement” between myself and Billy Waters, which has
converted itself into such an entirely satisfactory and amusing
friendship....
The result was that I’d dropped off to sleep again after Blodwen’s
bang on my bedroom door, and that I’d been the last down at
breakfast.
“Who’s this that’s coming, Billy?” I asked. “Your Uncle Albert
again?”
“No, thank—I mean, no, not him,” said Billy. “Some French people
you haven’t met yet. They’re touring North Wales in their car. He’s a
man I’ve had a good deal to do with in business.”
“And she——” began Theo, stopping uncharacteristically short as
her brother went on, tapping a letter he held.
“I’ve just heard from him that they’re in Holyhead now, and
coming over here to look us up this afternoon. So that puts a
stopper on our plan of painting that figure-head for Mrs. Roberts
after lunch. We’ll have to see if we can get it done this morning
instead. Good thing I got that paint last night at the wheelwright’s.
Are you on, Nancy? Then, if you’re ready, we’ll start now, shall we?”
“Blanche and I don’t think we’ll come, thank you,” said Theodora
punctiliously.
“What, not until you’re asked?” laughed her brother, rummaging
for the paint-pots under the southernwood bush at the cottage door.
He gave me one pot and the brushes to carry, taking the other two
himself. “Well, good-bye, all!”
“Come back, then, Cariad!” called Blanche, but the little white dog
frisked unheedingly in circles ahead of us, across the shingle at the
edge of the cove, over a couple of sand-hills, then up the steps cut
in the turf of the cliff where the Roberts have set up a flagstaff and
the wooden woman.

She’d been the figure-head of the Gwladys Pritchard, Mrs. Roberts


had told us, which had been wrecked in the bay below, many years
ago; the name and the face alike having been copied from the real
girl who was “cariad” to the owner of the vessel.
“She must have been pretty,” I thought, the first time I climbed
the cliff.
For many coats of paint, roughly applied, could not spoil or
disguise the setting of the carved girl’s eyes, nor the tender oval of
the up-tilted chin, nor the lines of the neck flowing down into the
sloping shoulders and the figure held up in an unmodern curve
above the corset of the Sixties, which must have set the fashion of
Miss Pritchard’s dress. She wore a little jacket with basques and
epaulettes and shoulder-seams set far down the sleeves; and a tiny
pork-pie hat, trimmed with a wing, was perched upon her hair, which
had been last painted yellow as the gorse that grew in hummocks all
around her. The jacket had been white, with trimmings of emerald
green; the same green, too, plastered the hat and the wooden
nosegay which she held up against her breast. Yet, for all this crude
green-and-white, for all the untaught modelling of it, there was a
vitality about this graven image which I’d never seen in any statue.
Was it because it had once been part of that live thing, a ship?
I could picture that image of a slender girl, leaning breast forward
again from the prow of her lover’s vessel as she heaved and dipped
like a gull on the waves; scanning horizons, joyously riding the gale,
and free to sea and sky!
Rooted in turf, the immobility of cliff and rock was now her prison,
while the gulls still screamed and wheeled above her....
And the real Gwladys?
“Did she go down with the ship?” I’d asked Mrs. Roberts.
“No, indeed, mam. There wasn’t one drowned on the Gwladys
Pritchard,” Mrs. Roberts had assured us. “That Miss Pritchard she
was marry to my cousin, Captain Lloyd, since—dear me, I don’t
know when. They keepin’ a public-house in Bluemaris now. Ô! she is
gone stout, too!”
“It would have been prettier if she’d been drowned,” Blanche had
said softly.
“Mam?” Mrs. Roberts had said.
But Mrs. Waters had finished the story by telling us gently,
“Anyhow, the Lloyds have three of the sweetest little grandchildren;
I’ve seen them!”
Evidently she had thought that for either woman or ship to be safe
in harbour like that was better than any more picturesque finale....
Well! I don’t know....

* * * * *

We reached the flagstaff, and set down our pots of paint among
the buffets of gorse that had sprays of purple ling and blue scabious
growing through and making a bouquet of each.
Billy’s shirt-sleeves are always rolled up to the elbow; the sleeves
of my white cotton frock are three-quarter length; so we were both
equipped for work, though I’d refused the offer of Mrs. Roberts’
sackcloth apron. It was too coal-y and butter-y and paraffiny and
scented with hen! But here the heady warm fragrance of the gorse
almost drowned the smell of our paints.
“Scarlet, and black, and white? Scarlet for her hat and jacket, eh?”
suggested Billy. “And how are we going to paint her hands and face?
What colour’s flesh?”
“Some people say it’s just the colour of honeysuckle,” I answered
absently. I can’t be perfectly certain that he did retort so sharply,
below his breath, “Does he, indeed!” or that the name of Sydney
Vandeleur had been threatening to crop up once more between us.
Still, I was glad of the wide pink shelter of my sun-bonnet as I
added, in a matter-of-fact way, “You could get a sort of flesh-tint by
mixing a little of the red with the white paint, but I don’t think I
should. Suppose we leave the face and hands creamy-white as they
are?”
“Very well; and her lips red, and the jacket and that toque affair,
with more dabs of scarlet for the flowers in her bunch,” he said,
kneeling on the sun-warmed turf on the other side of the figure from
me, “with a black wing in her hat.”
“And her hair left as it is, too,” said I.
“No, no! I got this on purpose for her hair,” he said, and drew a
full brushful of tar-black paint across the carven and crinkly locks in
front, “she must be a brunette, this time.”
“Oh, and Mrs. Roberts will be so annoyed to see her without her
beautiful golden chignon,” I protested, working away with the scarlet
paint at the back of the jacket, “she’ll think she’s quite spoilt.”
“Nonsense; looks much better like this,” he declared. “A black-
haired woman looks so much more alive than the others. Like red
wine, dark grapes, crimson roses ... fairer colours are insipid,
washed-out-looking!”
“No woman thinks so,” said I. “You never hear of a blonde tinting
herself dark. It’s always the other way about!”
“I know one girl who wouldn’t change,” he argued, glancing over
the shoulder of the wooden woman at the border of dark hair
between my bonnet and my face. “You needn’t pretend you would,
miss! Now what are you smiling at?”
“Only something,” I said, “that I’d just remembered.”
“Yes? (You’re an unexpected sex, aren’t you?) Well, what was
this?”
“Only—look out, Billy, you’ll let that black drop run down the side
of her face—only something a girl I know said about fair men being
like weak tea!”
“Meaning to say, I suppose, that she didn’t think much of your
taste in fiancés?” suggested Billy Waters, with a mischievous laugh. I
laughed too. And for the several score of times since we have been
here together, I thought to myself what a delightful and unusual and
thoroughly satisfactory arrangement this friendship of ours had
turned out to be.
I never dreamed that at that very moment the life of that
friendship had about five more minutes to run.
“There!” said Billy, picking himself up and taking a few steps back
from the figure, to survey it, with his fair head on one side. “You
can’t say it isn’t an improvement. What would your friend say to that
coloured hair?”
“Strong tea,” I suggested flippantly. “Tea that’s stood too long!”
“You aren’t looking at it. Come over here and see!”
I straightened myself and went and stood beside him.
“As a matter of fact, Nancy, the lady’s got rather a look of you!”
And actually something in the contrast of the glistening black locks
against the creamy-pale face with the now scarlet-tinted lips might
have been vaguely characteristic of what, night and morning, I see
in my own mirror.
“Well, but I hope I don’t look as if I ‘made up’ my mouth!”
“Why, you don’t make it up, do you?”
“Of course not,” said I. And then I turned from looking at the
painted figure to the other deeper, tenderer colour of the sea
washing a strip of sand below the cliff.
“Oh, it is lovely here,” I sighed, revelling in the beauty of that and
the sky. “Did you ever see anything so blue as it is to-day?”
“Or so golden?” added Billy, nodding towards the hassocks of
gorse in full bloom. “I’ve never seen it like this before. D’you know
that there’s a Welsh proverb that calls this county ‘the land of
thriftless gold’? Rather pretty, isn’t it? It must have been wonderful
here in the spring; this is the second crop, you know. A man I know
once told me that it was like falling in love.”
“How d’you mean?” I asked, as he stopped. “Aren’t you going to
paint the wing in her hat while you’ve that brush full of black paint?”
“Presently.—Oh, yes, about that gorse. He said the first blooming
was more showy—more fuss made over it—first love, you know, and
all that; but that it was nothing like as sweet as the later time.
Should you agree with him, d’you think?”
“How should I know?” I retorted rather flippantly, to hide my
intense surprise that Billy should possess—let alone quote!—a friend
who sounded so utterly unlike himself. “You might know me well
enough by this time to see I’m not that sort of girl!”
“Which sort of girl? The kind who doesn’t fall in love a second
time?”
“The kind who doesn’t fall in love at all,” I said decidedly.
“Anyhow, I find the second blooming of the gorse, without any
metaphors, quite beautiful enough against that dragonfly-blue bit of
Bay!”
“Ah, yes! You’re fond of the effect of flowering plants against the
blue sea, as I think you mentioned, the evening my uncle dined at
The Lawn,” said Billy, teasingly and unexpectedly. “Only, didn’t you
specify oleanders and myrtles and the Riviera——”
“Oh, Billy! I never thought you’d do that,” I interrupted him with
real reproach. “No; I never thought you’d be so mean as to remind
me, ever again, of that ghastly evening! I didn’t!”
There was silence for a moment. He stared down at me. I
wouldn’t look at him. I turned to look at a brown velvet bee that was
buzzing some flattery or other into the golden ear of a gorse-
blossom near by. Then I heard him say slowly:
“‘Ghastly,’ you call it?”
“Well—! Of course!”
“I see,” he said, still more slowly. “You mean that it still rankles.
You haven’t forgotten.... You resent that still, in spite of agreeing to
be friends ... in spite of letting one suppose that—well! that it wasn’t
so sickeningly hard for you now, after all. You do bear a grudge
then, still. You mean—” It came out, the last thing I ever expected
to hear him mention!—“that about that kiss!”
“That?” I retorted quickly, and with my airiest laugh, for this
seemed the only way in which to face the paralysingly embarrassing
point he’d seen fit to raise again. “Oh, that! I never gave it a
thought, Billy! I quite understood! Besides, you couldn’t possibly call
that private-theatricals sort of peck a kiss, exactly!”
“No,” he returned, as quickly. “You couldn’t, could you?”
He took a step towards me, then caught me to him by the
shoulders, and for a second I thought he was going to gratify the
longing which I’d seen in his eyes any time during that first week of
my stay at The Lawn.
I thought he was going to shake me.
But no.
In quicker time than it can be told, his hands had flown from my
shoulders to the pink strings of my sun-bonnet; he’d untied them
and tossed the bonnet on to the nearest hassock of a gorse-bush.
He put both brown hands under my chin and turned my face up to
his. Before I could so much as gasp, he swooped down and kissed
me, muttering, “But what could you call this—and this—and this?”
Three times—greedily—on the mouth.
For a second I had to clutch at his shoulder to steady myself; for
sea and cliff and gorse seemed wheeling round me in swirls of blue
and green and gold.
Then I wrenched myself away and faced him—without seeing too
distinctly what was in front of my eyes.
“Don’t say anything to me,” I heard myself tell him, in a voice that
sounded unnaturally quiet and calm. “This—this can’t be forgiven.
Don’t ask.”
I heard him begin to say something about: “Do you think I am
made of——”
“Don’t speak to me again, please,” I said, still in that unnaturally
quiet voice. “Not again.”
I snatched up my sun-bonnet from the gorse-bush, rammed it
down over my hair, and tied the strings so tightly beneath my chin
that they nearly throttled me. Then I turned, saying, “I forbid you to
follow me,” and left him standing there between cliff and sky, beside
the wooden woman.
I walked on until I thought I was out of his sight, then I ran; ran
blindly across the cove and up the sandy path to the cottages.
On the doorstep of the larger one Theo was sitting, emptying her
white canvas shoes of sand on to the cobbles of the garden path.
“Hullo, Nancy! Do you know that Cariad was so bored with you
that he ran home?” she said. “What have you done with Billy the
Beloved? Is he——”
“Let me pass, please,” I said quietly, and walked swiftly into the
house. The kitchen door was open and Mrs. Roberts was laying the
table for the mid-day meal. She began, “Was you finiss paint the
——” but I couldn’t stop to speak to her. I ran up the rickety wooden
stairs to my bedroom. There isn’t a lock on the door; I looked. So I
just latched it, and went and sat down on my bed, with its
patchwork quilt of faded pinks and mauves. I began tracing with my
fingers the pattern made by the hexagonal patches of purple. I don’t
think I thought of anything at all.
And I don’t know how long I’d been sitting there before I heard
light steps on the staircase and a tap at the door. I raised my voice a
little.
“Don’t come in.”
“Nancy,”—it was Blanche—“dinner’s ready!”
“I don’t want any dinner. I am not coming down.”
“Oh!—What’s the matter, dear?”—with quick concern. “Are you ill?”
“No! I’m not ill!”
“Have you got a headache?”
“No! I haven’t got a headache. Only please go away. I don’t want
to see anybody.”
I heard her go softly downstairs again—then the kitchen door
opening, and a murmur of voices.
His voice.

Ah! that brought my anger surging over me at last like a great


wave. I sat bolt upright, with a crumple of the quilt clutched in each
hand.
How dared he! How dared he!
Taking odious advantage of a situation! This was not what I
agreed to when I said I would be nominally engaged to him.
This was not unavoidable, like that last time.
Oh! He needn’t have pointed out to me the difference between
that time and this! I’d thought I was angry then. My anger now was
as different a thing as the difference between those two sorts of
kisses.
Oh!
He’s broken the contract—he knows that it was tacitly understood
that there should be nothing of this—In fact, it wasn’t so much as
thought of—ever.
Right on my mouth!...
Well, I don’t owe him anything after this. I shan’t speak to him
again. I shall have nothing more to do with him. He’s a right to my
name as his official fiancée, he can keep that—at a distance! My
name—nothing else. I shan’t go on staying with his people after this!
Let him make what excuse he chooses to his mother about that. Let
him explain it away as he likes. I shan’t help him!
If it were to save his life, I’d never lift a finger to help him again!
I shall go away at once....
How could he! Whether it was a vulgar attempt at flirtation, or
simply that he was riled and meant to be rude to me in the most
brutal manner he could think of—I don’t care which it was!
What had I said—done—looked—that he should imagine he
might?
After this, he might even say I’d encouraged him!
Hateful, hateful!
Well, I shall go away....
Brute!
To-morrow, I shall go!
CHAPTER XXIII
“MANY WATERS——”

Well! Anyhow there’s no sense in sitting up in my room brooding


over this thing, on a heavenly afternoon like this and all.
I’m not going to miss it all just to please him.
And if I am leaving everything—sea and sunshine and mountains
—to-morrow, I may as well take in as much of them as I can to-day.
Besides, I suppose I shall have to go down some time.
There are these people—whoever they are—expected this
afternoon. Obviously I shall have to be at tea to meet them? I
shouldn’t in the least mind letting him down by remaining invisible
until I’m all packed up and ready for the little local train that must
take me up to Holyhead to meet the Euston mail. But there is his
mother to consider—she has been so sweet to me from the
beginning. What I can’t understand about her is how she ever
managed to have such a son? There must have been something odd
and horrid about the father; and he must take after him. The girls
are all right.
There they are, going out now; down the sandy path to the
station; Theo bare-legged and bare-headed as usual, swinging a
basket; off to buy jam, I expect, for the visitors’ tea; Blanche
carrying letters. I heard his step on the cobbles ten minutes ago,
and Mrs. Waters always rests in her room until three o’clock. The
coast’s quite clear, then. Why shouldn’t I go out and have my bathe?
I missed it this morning—thanks to all that! Perhaps the cool green
waves of the Bay will help me to feel as if I’d washed a little of that
memory away from me. Already it seems years since my last bathe;
only yesterday morning! When the girls and I ran down together, to
find him already in, practising walking under the water; and he’d
called out “I say! Isn’t it topping to be alive on a day like this?” as he
emerged, head up once more, dripping and glowing in his indigo-
blue sheath, his hair sleek once more with the wet, his arms and
shoulders as smooth and pinky-white as any of ours, but making
ours look curiously slender and delicate.
Years ago! Everything had been so different! I’d thought he was
so different.
Well! This will be my last bathe for the summer, so I may as well
enjoy it, all to myself.

* * * * *

I undressed quickly, slipped into my black woven silk club


costume, and twisted round my head the long orange silk scarf that
keeps my hair from getting too wet. I simply won’t take to one of
those sponge-bag-like rubber caps that some girls still wear for
bathing. They’re too unsightly for anything—and one doesn’t exactly
want to look a blot on the seascape, even if there doesn’t happen to
be anyone else bathing, to see one....
As it happened, I found, to my great annoyance, that there was
someone else already in the little cove next to the cottages that it
was Theo’s idea to christen “The Bay of Many Waters.” There was a
smooth head, some distance out, dark against the afternoon glitter;
a steady stroke that I knew.
Oh!
So he’d come out first!
Well, that meant that I couldn’t have my bathe here after all—just
like him!... Fresh rage against him surged up in me as I caught up
the white wrap of Turkey-towelling that I had thrown down upon a
seaweedy rock with my string-soled shoes. I’d leave him to it.
Perhaps I could get a dip in the next bay under that cliff where the
wooden woman leaned forward to her watch?
But, even as I turned to slip away, I heard a sound from across
the water that seemed to make my heart, for a second, stop its
beating.
It was a choking shout for help.
“Nancy!—Here!—Here!”
Then that dark head disappeared under the water.
It couldn’t possibly have been for as long as it seemed. No!
People can’t hold their breath for as long. Then it was up again.
The swimmer had flung himself on his back and was floating. And I
—without actually realizing what I had been doing, I must have cast
off my wrap again, have splashed through the creamy surf of the
first waves into the smoother jade-green depths beyond, for I found
myself swimming, striking out, out—from the shore....
Still I didn’t know how I’d started—or why. Except that here was a
human being in trouble whom, somehow or other, I had to help. I
didn’t think about who it was. It wasn’t because of that broken shout
of “Nancy!” I’m sure. No; I am sure that, just then, no thought of
saving Still Waters was in my mind. It was just another human being
who had called to me; and towards whom I swam so desperately,
making, in my hurry, such a splashing over each stroke that it
seemed to me endless before I came up to where he floated on his
back.
Automatically I remembered something our swimming-instructor
had drilled into us at school. I found myself telling myself that it was
dangerous—dangerous to get within reach of a drowning person’s
hands. They’d grip you, and you’d both go under.
“Keep behind him,” I was telling myself. “Keep behind him!”
But there was no need for me to trouble about avoiding his clutch.
When he spoke, I realized that he, in his danger, was keeping his
head far better than I was. He was calm.
“Cramp,” I heard him say, “in my left leg. You’ll have to tow me.
Can you swim on your back?”
“Yes.”
Whether I could or not, I supposed, I should have to.
So in turn I flung myself on my back, and caught hold of him
under those hard, strong-feeling arms of his.
Then began the struggle back to shore.
The tide was setting in, thank heaven! and as long as we were in
the deep waters it was not so hard. Presently we came to where the
waves began to break. The wind was blowing off the shore, blowing
the surfy crests of the waves backwards as a girl’s hair is blown
across her face ... and presently I was half blinded by the spray that
dashed over my head, into my eyes and mouth.
I choked, panted....
“Rest a minute,” said a voice close to me. “No hurry. The tide will
take us both in.” ...
But, getting my breath, I struggled on again, yard by yard. Again I
got a mouthful; spluttered, coughed.
“All right—all right—take it easy!” the voice was saying.
I simply couldn’t pay any attention to that—I was labouring with
all my strength for both—for myself and this log in the water that I
must—must get ashore. I was startled when he gave a sudden
powerful jerk of his shoulders that altered our course.
“You’ll have us on to the reef,” he said. “I’ll steer—don’t work so
hard—”
I heard myself gasping.
—“don’t get flurried, Nancy!”
“Nancy!” Yes! Then I did realize who it was that I was tugging
along with me for dear life. His life was in my hands—mine, when I’d
felt ready to murder him an hour ago. I’d had to save it.... “Serve
him right,” I thought wildly, as I struggled along. “Oh, serve him
right! I’ll show him—I’ll teach him to kiss me again.”
Indeed, I’m not sure that I wasn’t muttering this aloud to myself
in the water. Anyhow, voices seemed buzzing in my ears—one was
his own as I’d heard it yesterday—“I say! Isn’t it topping to be alive?
Isn’t it topping to be alive?”
And then it seemed to come to the very last effort I could make.
“Ah!” I heard myself groan.
The next thing of which I was conscious came with a shock of
surprise. It was the soft jolt of my shoulders against sand.
We were aground!
For a minute or so I must have been swimming furiously in my
depth, without even feeling the growing warmth of the shallows
about me.
I let go my wild, unneeded clutch of his arms, staggered to my
feet, waded in, then dropped again, face downwards and panting,
on to the beach, a few yards below the tide-mark of crisp, black
seaweed, straws, and broken shell.
It was over—we were safe. And now—what?
I didn’t know.
Anyhow, for a moment I lay there unable to rise or speak. I threw
my arm across my eyes. Then I found that he’d dragged himself up
beside me. He was leaning over me; saying something I was too
dazed to catch.
I didn’t want to hear it. I didn’t want him to say anything. He
needn’t suppose I’d intended to save his life. He needn’t think this
absurd crisis had made any difference. There was still this morning
between us. There always would be. This made no difference. None!
None at all!
I got up again, hearing my teeth chatter a little. I turned to the
rock where I’d thrown down my peignoir, and as I did so, I heard
him behind me raise his voice a little:
“I say! I can’t, you know!—You’ll have to help me up to the
cottages, I’m afraid—”
I glanced down at him; he was sitting up, his face a little white
under the tan, but quiet and expressionless. And as I looked at him,
sitting there backed by the empty, sunlit cove and the cliff with the
figure-head and flagstaff small as toys in the distance, I passed
through the one second’s most extraordinary experience of my life.
Was it a waking-dream, or what? The result of shock and over-
exertion, like those buzzing voices, just before, among the waves?
For of all the mad, impossible fancies to dash into one’s mind—
before one’s eyes, even!—this was the maddest.
This was what happened in that second’s space:
Vividly there flashed before me a picture of my own Self just as I
was then, in my black silk maillot with my wet black hair streaming
down my neck; for I’d lost my scarf, it floated like a torn-off strand
of orange-coloured seaweed on the waves. I saw it there.... And I
saw that mind-picture of myself fling herself down on her knees
beside him again—fling herself into his arms, cold from the sea-
water and dripping and hard; saw her bury her face against his
throat; heard, more clearly than in a dream, her gasping sob of,
“Billy! You were drowning! I might have lost you!”
Then—flick! the picture vanished, and I was drawing my wrap
about me composedly enough as I replied to him coldly, “I will help
you up—on one condition. That you don’t speak to me.”
He said quietly, “You prefer that?”
“Only on that condition,” I repeated.
“Very well,” he rose slowly to his feet, trying them one after the
other in the sand. “Only—I’m afraid I shall have to lean on you a bit
—not hard.”
So, after I’d helped him on with his own wrap, I stood for him to
put his arm about my shoulders. I don’t know if he leaned hard or
no. Slowly and in silence, we walked up so from the shore to the
cottages. Just before we got to the sandy path in front, his arm
dropped, and he smothered an exclamation:
“Hul-lo!”
For, tilted up between the deep ruts made by Mr. Roberts’ cart in
the sand in front of the cottage gardens, we caught sight of a
motor-car; a gaudy, cherry-coloured affair, all ablaze with sunlit
brass. The visitors. They’d come, then. I’d forgotten them. They
were in my cottage at tea, I discovered, after he had turned quickly
in at the little gate of the cottage he shares with Blanche; from
behind the door of the kitchen sitting-room of our larger one I heard
a babble of talk and much laughter. Must I face it? With this dreadful
day behind me? Slowly I mounted the wooden stairs to my room
and began to dress. I was, all of a sudden, deadly tired; why, I felt
only half awake; what I would have liked would have been to fling
myself down on that patchwork-quilted bed and sleep the time away
until I was to leave Porth Cariad for ever.
That this must needs have happened this afternoon, to add to the
conglomeration of things between him and me that I longed to
forget! After the way he behaved this morning!
(Ah, Billy, why did you? We were such chums!) Caddish of him! To
think that he might—that I could be treated so!
That fact remained—and all the waves in the Bay of Many Waters
hadn’t washed any of its bitterness away. As for that mad, mad
fancy of mine afterwards on the beach—well! it must have been
something like the way people declare that the whole of a drowning
person’s past life rises before them in the moment of peril. Only, of
course, those would be pictures of things that had happened—not
the reverse of anything that ever, ever could happen!
One thing—I’d never let him thank me for the outwardly
magnanimous act into which I’d been just forced, and which had left
me too utterly exhausted even to rage over it as I might. My arms
felt almost too limp to raise to my head as I wrung my streaming
hair into a towel and pinned it, still wet, firmly about my head. It
took me minutes to put on each garment. Meantime those minutes
were ebbing away, and these people downstairs were being kept
waiting, expecting to see his official fiancée at the tea-table. And if I
felt I couldn’t stay up here as I longed to do, it wasn’t on his
account. It wasn’t the girl he’d engaged—and insulted so!—it was his
mother’s guest who confronted in the wavy looking-glass her very
washed-out appearance, her dark, ringed eyes and damp hair
plastered down to keep it from dripping on to the first clean blouse
that had come to hand.
Certainly I looked very little credit to him!
With a shrug I turned away and went downstairs.

* * * * *

The warm kitchen seemed full of people and their voices, and of a
mingled scent of brewing tea and warm butter and—could it be a
whiff of perfume: trèfle? The tea-table was crowded with Mrs.
Roberts’ gayest crockery, with her largest black teapot, with mounds
of yellow light-cakes and clusters of brown eggs and great slabs of
Welsh farmhouse bread-and-butter. In the middle a glass jug held a
bouquet of heather and honeysuckle and blue scabious. There was a
dish of damson jam, and a very golden, “shoppy” cake.
At the head of the table, Mrs. Waters was entertaining a stout,
sallow gentleman with a black moustache and a plaid tie, who was
talking French very fast and with a good deal of gesture. Blanche,
elbows on the table, was leaning eagerly across it to talk; opposite
to her were her brother, looking much as usual again, I saw, and
Theodora in a state of flushed animation, from whom, in the general
babble, I caught something that sounded like “tell Billy’s sweetheart
—” and between Theodora and him there sat, leaning back in her
chair and laughing gaily, a young girl in a wonderfully-cut and simple
get-up of flame-yellow and white and cream, with a swirl of feathery
yellow about her midnight black hair; one of the prettiest girls I’d
ever seen in my life. Ah! it was she who’d brought in that whiff of
clover-scent?
She was laughing up into his face.
And she was calling my official fiancé “Billy.”
CHAPTER XXIV
THAT GIRL

There was a scraping of wooden chair-legs on the tiled kitchen


floor as I came in, and the men rose.
Mrs. Waters introduced “Our friend Monsieur Charrier and his
daughter”—and the stout gentleman, who wore pale-hued boots
shaped like the blades of oars, bowed until I could see the rolls of
fat beneath his collar behind, then shot at me out of eyes like two
black currants a glance that made me feel utterly disapproved-of and
“found wanting.” The girl gave me a look less frankly measuring,
while the whitest teeth in the world flashed in her little face, oval
and smoothly olive as the shell of one of those eggs on the table.
She was very lovely....
She held out her hand and gave mine the violent shake that
foreigners seem to think so truly English; and then I slipped into the
empty place next to Blanche, feeling thankful for the tea which Mrs.
Waters handed to me in a large cup decorated with a group of Welsh
women in the costume never seen except on china.
I drank it in a kind of thirsty dream; I couldn’t have talked to save
anyone’s life just then; but the talk was buzzing on all around.
“—planned to go to-morrow; but shall you be here?”
“—since we find ourselves in such charming neighbourhood, we
could prolong our sojourn——”
“Oh, yes, do prolong it! So ripping for Blanche and me to have
Odette to go about with! Of course, we never see Billy and Nancy
here!”
“Don’t believe her, Odette!” he was laughing quite naturally.
“—can’t call your shore your own, this year! You don’t know what
it is to have an engaged couple in the place!”
“No? It is not agreeable?” The pretty French girl turned to smile at
him again. “You do not encourage me to come, so!”
“I’m writing a book about it——”
“Theo dear, finish your tea and don’t talk so much!”
“‘The Complete Gooseberry’ it’s called, if you know what that
means.”
“Ah! Place where you find the little babies! Yes?”
“No! not place! People! Unengaged ones like us and you and
everybody but Them.”
“—Enchanted, madame!”
“—with rules like this: ‘Don’t cough outside doors; they hate it. Far
better not go in!’”
“—More hot water, please, Blodwen——”
“—Don’t stalk them with a camera. You never get anything worth
printing!”
“—And will I bring a two more fress negg, mam?”
“If one of them’s away, don’t ask who’s got the ink!”
“—No, but do you remember the bathing at Dinard?”
“—Next year, perhaps——”
“—start before lunch——”
“—if the tide’s right——”
“—But Monsieur Charrier, as you were saying——”
“—icy!”
“—as warm as warm!”
“How was it to-day, Nancy?”

You might also like