You are on page 1of 43

Codeless Data Structures and

Algorithms: Learn DSA Without Writing


a Single Line of Code Armstrong
Subero
Visit to download the full and correct content document:
https://textbookfull.com/product/codeless-data-structures-and-algorithms-learn-dsa-wi
thout-writing-a-single-line-of-code-armstrong-subero/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

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/

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/

Programming PIC Microcontrollers with XC8 1st Edition


Armstrong Subero

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

Probabilistic data structures and algorithms for big


data applications Gakhov

https://textbookfull.com/product/probabilistic-data-structures-
and-algorithms-for-big-data-applications-gakhov/
Data Structures and Algorithms in Swift Kevin Lau

https://textbookfull.com/product/data-structures-and-algorithms-
in-swift-kevin-lau/

Data Structures & Algorithms in Python John Canning

https://textbookfull.com/product/data-structures-algorithms-in-
python-john-canning/

A Common Sense Guide to Data Structures and Algorithms


1st Edition Jay Wengrow

https://textbookfull.com/product/a-common-sense-guide-to-data-
structures-and-algorithms-1st-edition-jay-wengrow/

Programming Microcontrollers with Python: Experience


the Power of Embedded Python 1st Edition Armstrong
Subero

https://textbookfull.com/product/programming-microcontrollers-
with-python-experience-the-power-of-embedded-python-1st-edition-
armstrong-subero/

Programming Microcontrollers with Python: Experience


the Power of Embedded Python 1st Edition Armstrong
Subero

https://textbookfull.com/product/programming-microcontrollers-
with-python-experience-the-power-of-embedded-python-1st-edition-
armstrong-subero-2/
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
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.


Big O
The way we mathematically determine the efficiency of an algorithm
can fall into one of three categories. We can measure the worst-case
scenario, which is the longest time our algorithm will take to run; we
can measure the best-case scenario, which is the shortest time our
algorithm will take to run; or we can measure both cases, which is both
the best case and the worst case. Sometimes we can also measure the
average case, which is how we expect our algorithm to run most of the
time.
There are many notations we use for describing the efficiency of our
algorithm including Big Omega, Little Omega, Big O, Little O, and Theta.
Each notation has its application; however, some methods are used in
the industry more frequently than others.
Of all these methods, Big O is the one that is most utilized for
asymptotic analysis notation. If you have heard of this notation, then
you may wonder why it is called Big O. Well, the O in Big O refers to the
“order of complexity” or the “order.” We usually write the order of
complexity of something with a capital O or a “big O.” That is why we
call it Big O notation.
In other forms of notation, omega notation describes the
measurement of the minimum time our algorithm will take to run, and
theta describes the minimum and maximum time our algorithm will
take to run. By contrast, Big O describes the maximum amount of time
our algorithm will take to run. In essence, Big O describes the worst-
case running time of our algorithm.
There are many ways to describe Big O runtime, but here are some
types of Big O run times you will come across:
O(1): The algorithm has a constant execution time, which is
independent of the input size.
O(n): The algorithm is linear, and performance grows in proportion
to the size of the input data.
O(log n): The algorithm is logarithmic; as time increases linearly,
then n will go up exponentially. This means that more elements will
take less time.
O(n log n): The algorithm is logarithmic multiplied by some variable
n.
O(n^2): The algorithm is quadratic, and the running time is
proportional to the square of the input.
O(2^n): The algorithm is exponential; execution time doubles with
the addition of each new element.
O(n!): The algorithm is factorial and will execute in n factorial time
for every new operation that is performed.
These classifications are the ones you will come across most often.
Constant time has the best performance followed by logarithmic time.
The factorial O(n!) has the worst time possible; it is terrible! In fact, it is
at the heart of a complex computer science problem, the traveling
salesperson problem that we discussed earlier.

Conclusion
In this chapter, we got an introduction to data structures and
algorithms. We discussed data, functions, data structures, and
algorithms. We also looked at primitive data types, iteration, and
recursion as well as the three fundamental types of algorithms. We then
went a step further and discussed analyzing algorithms as well as the
basics of Big O notation. This was a lot of information, and believe it or
not there are many practicing developers who do not understand some
of the topics presented in this chapter, so you are already ahead of the
pack. In the next chapter, we will begin our “deep dive” into the world
of DSA, as we will discuss linear data structures.
Another random document with
no related content on Scribd:
TURBOT À LA CRÊME.

Raise carefully from the bones the flesh of a cold turbot, and clear
it from the dark skin; cut it into small squares, and put it into an
exceedingly clean stewpan or saucepan; then make and pour upon it
the cream sauce of Chapter V., or make as much as may be
required for the fish by the same receipt, with equal proportions of
milk and cream and a little additional flour. Heat the turbot slowly in
the sauce, but do not allow it to boil, and send it very hot to table.
The white skin of the fish is not usually added to this dish, and it is of
better appearance without it; but for a family dinner, it may be left on
the flesh, when it is much liked. No acid must be stirred to the sauce
until the whole is ready for table.
TURBOT AU BÉCHAMEL, OR, IN BÉCHAMEL SAUCE.

Prepare the cold turbot as for the preceding receipt, but leave no
portion of the skin with it. Heat it in a rich bechamel sauce, and serve
it in a vol-au-vent, or in a deep dish with a border of fried bread cut in
an elegant form, and made with one dark and one light sippet,
placed alternately. The surface may be covered with a half-inch layer
of delicately fried bread-crumbs, perfectly well drained and dried; or
they may be spread over the fish without being fried, then moistened
with clarified butter, and browned with a salamander.
For Mould of Cold Turbot with Shrimp Chatney, see
Chapter VI.
TO BOIL A JOHN DORY.

[In best season from Michaelmas to Christmas, but good all the
year.]
The John Dory, though of uninviting
appearance, is considered by some
persons as the most delicious fish that
appears at table; in the general estimation,
however, it ranks next to the turbot, but it is
far less abundant in our markets, and is not
commonly to be procured of sufficient size
for a handsome dish, except in some few
parts of our coast which are celebrated for
John Dory. it. It may easily be known by its yellow gray
colour, its one large dark spot on either
side, the long filaments on the back, a
general thickness of form, and its very ugly head. It is dressed in the
same manner, and served usually with the same sauces as a turbot,
but requires less time to boil it. The fins should be cut off before it is
cooked.
SMALL JOHN DORIES BAKED.

(Author’s Receipt—good.)
We have found these fish when they were too small to be worth
cooking in the usual way, excellent when quite simply baked in the
following manner, the flesh being remarkably sweet and tender,
much more so than it becomes by frying or broiling. After they have
been cleaned, dry them in a cloth, season the insides slightly with
fine salt, dredge a little flour on the fish, and stick a few very small
bits of butter on them, but only just sufficient to prevent their
becoming dry in the oven; lay them singly on a flat dish, and bake
them very gently from fourteen to sixteen minutes. Serve them with
the same sauce as baked soles.
When extremely fresh, as it usually is in the markets of the coast,
fish thus simply dressed au four is preferable to that more
elaborately prepared by adding various condiments to it after it is
placed in a deep dish, and covering it with a thick layer of bread-
crumbs, moistened with clarified butter.
The appearance of the John Dories is improved by taking off the
heads, and cutting away not only the fins but the filaments of the
back.
TO BOIL A BRILL.

A fresh and full-sized brill always ranks high in the list of fish, as it
is of good appearance, and the flesh is sweet and delicate. It
requires less cooking than the turbot, even when it is of equal size;
but otherwise may be dressed and served in a similar manner. It has
not the same rich glutinous skin as that fish, nor are the fins
esteemed. They must be cut off when the brill is cleaned; and it may
be put into nearly boiling water, unless it be very large. Simmer it
gently, and drain it well upon the fish-plate when it is lifted out; dish it
on a napkin, and send lobster, anchovy, crab, or shrimp sauce to
table with it. Lobster coral, rubbed through a sieve, is commonly
sprinkled over it for a formal dinner. The most usual garnish for
boiled flat fish is curled parsley placed round it in light tufts; how far it
is appropriate, individual taste must decide.
Brill, moderate-sized, about 20 minutes; large, 30 minutes.
Obs.—The precise time which a fish will require to be boiled
cannot be given: it must be watched, and not allowed to remain in
the water after it begins to crack.
TO BOIL SALMON.

[In full season from May to August: may be had much earlier, but is
scarce and dear.]
To preserve the fine colour of this fish, and to set the curd when it
is quite freshly caught, it is usual to put it into boiling, instead of into
cold water. Scale, empty, and wash it with the greatest nicety, and be
especially careful to cleanse all the blood from the inside. Stir into
the fish-kettle eight ounces of common salt to the gallon of water, let
it boil quickly for a minute or two, take off all the scum, put in the
salmon and boil it moderately fast, if it be small, but more gently
should it be very thick; and assure yourself that it is quite sufficiently
done before it is sent to table, for nothing can be more distasteful,
even to the eye, than fish which is under dressed.
From two to three pounds of the thick part of a fine salmon will
require half an hour to boil it, but eight or ten pounds will be done
enough in little more than double that time; less in proportion to its
weight should be allowed for a small fish, or for the thin end of a
large one. Do not allow the salmon to remain in the water after it is
ready to serve, or both its flavour and appearance will be injured.
Dish it on a hot napkin, and send dressed cucumber, and anchovy,
shrimp, or lobster sauce, and a tureen of plain melted butter to table
with it.
To each gallon water, 8 oz. salt. Salmon, 2 to 3 lbs. (thick), 1/2
hour; 8 to 10 lbs., 1-1/4 hour; small, or thin fish, less time.
SALMON À LA GENEVESE.

A fashionable mode of serving salmon at the present day is to


divide the larger portion of the body into three equal parts; to boil
them in water, or in a marinade; and to serve them dished in a line,
but not close together, and covered with a rich Genevese sauce (for
which see Chapter V.) It appears to us that the skin should be
stripped from any fish over which the sauce is poured, but in this
case it is not customary.
CRIMPED SALMON.

Cut into slices an inch and a half, or two inches thick, the body of a
salmon quite newly caught; throw them into strong salt and water as
they are done, but do not let them soak in it; wash them well, lay
them on a fish-plate, and put them into fast boiling water, salted and
well skimmed. In from ten to fifteen minutes they will be done. Dish
them on a napkin, and send them very hot to table with lobster
sauce, and plain melted butter; or with the caper fish-sauce of
Chapter V. The water should be salted as for salmon boiled in the
ordinary way, and the scum should be cleared off with great care
after the fish is in.
In boiling water, 10 to 15 minutes.
SALMON À LA ST. MARCEL.

Separate some cold boiled salmon into flakes, and free them
entirely from the skin; break the bones, and boil them in a pint of
water for half an hour. Strain off the liquor, put it into a clean
saucepan and stir into it by degrees when it begins to boil quickly,
two ounces of butter mixed with a large teaspoonful of flour, and
when the whole has boiled for two or three minutes add a
teaspoonful of essence of anchovies, one of good mushroom catsup,
half as much lemon-juice or chili vinegar, a half saltspoonful of
pounded mace, some cayenne, and a very little salt. Shell from half
to a whole pint of shrimps, add them to the salmon, and heat the fish
very slowly in the sauce by the side of the fire, but do not allow it
boil. When it is very hot, dish and send it quickly to table. French
cooks, when they re-dress fish or meat of any kind, prepare the flesh
with great nicety, and then put it into a stewpan, and pour the sauce
upon it, which is, we think, better than the more usual English mode
of laying it into the boiling sauce. The cold salmon may also be re-
heated in the cream sauce of V., or in the Mâitre d’Hôtel sauce which
follows it; and will be found excellent with either. This receipt is for a
moderate sized dish.
SALMON BAKED OVER MASHED POTATOES.

We are informed by a person who has been a resident in Ireland,


that the middle of a salmon is there often baked over mashed
potatoes, from which it is raised by means of a wire stand, as meat is
in England. We have not been able to have it tried, but an ingenious
cook will be at no loss for the proper method of preparing, and the
time of cooking it. The potatoes are sometimes merely pared and
halved; the fish is then laid upon them.
SALMON PUDDING, TO BE SERVED HOT OR COLD.

(A Scotch Receipt—Good.)
Pound or chop small, or rub through a sieve one pound of cold
boiled salmon freed entirely from bone and skin; and blend it lightly
but thoroughly with half a pound of fine bread-crumbs a teaspoonful
of essence of anchovies, a quarter of a pint of cream, a seasoning of
fine salt and cayenne, and four well whisked eggs. Press the mixture
closely and evenly into a deep dish or mould, buttered in every part,
and bake it for one hour in a moderate oven.
Salmon, 1 lb.; bread-crumbs, 1/2 lb.; essence of anchovies, 1
teaspoonful; cream, 1/4 pint; eggs, 4; salt and cayenne; baked 1
hour.
TO BOIL COD FISH.

[In highest season from October to the beginning of February; in


perfection about Christmas.]
When this fish is large the head and shoulders are sufficient for a
handsome dish, and they contain all the choicer portion of it, though
not so much substantial eating as the middle of the body, which, in
consequence, is generally preferred to them by the frugal
housekeeper. Wash the fish, and cleanse the inside, and the back-
bone in particular, with the most scrupulous care; lay it into the fish-
kettle and cover it well with cold water mixed with five ounces of salt
to the gallon, and about a quarter of an ounce of saltpetre to the
whole. Place it over a moderate fire, clear off the scum perfectly, and
let the fish boil gently until it is done. Drain it well[46] and dish it
carefully upon a very hot napkin with the liver and the roe as a
garnish. To these are usually added tufts of lightly scraped
horseradish round the edge. Serve well-made oyster sauce and plain
melted butter with it; or anchovy sauce, when oysters cannot be
procured. The cream sauce of Chapter V., is also an appropriate one
for this fish.
46. This should be done by setting the fish plate across the kettle for a minute or
two.

Moderate size, 20 to 30 minutes. Large, 1/2 to 3/4 hour.


SLICES OF COD FISH FRIED.

Cut the middle or tail of the fish into slices nearly an inch thick,
season them with salt and white pepper or cayenne, flour them well,
and fry them of a clear equal brown on both sides; drain them on a
sieve before the fire, and serve them on a well-heated napkin, with
plenty of crisped parsley round them. Or, dip them into beaten egg,
and then into fine crumbs mixed with a seasoning of salt and pepper
(some cooks add one of minced herbs also), before they are fried.
Send melted butter and anchovy sauce to table with them. 8 to 12
minutes.
Obs.—This is a much better way of dressing the thin part of the
fish than boiling it, and as it is generally cheap, it makes thus an
economical, as well as a very good dish: if the slices are lifted from
the frying-pan into a good curried gravy, and left in it by the side of
the fire for a few minutes before they are sent to table, they will be
found excellent.
STEWED COD.

Put into boiling water, salted as usual, about three pounds of fresh
cod fish cut into slices an inch and a half thick, and boil them gently
for five minutes; lift them out, and let them drain. Have ready heated
in a wide stewpan nearly a pint of veal gravy or of very good broth,
lay in the fish, and stew it for five minutes, then add four
tablespoonsful of extremely fine bread-crumbs, and simmer it for
three minutes longer. Stir well into the sauce a large teaspoonful of
arrow-root quite free from lumps, a fourth part as much of mace,
something less of cayenne, and a tablespoonful of essence of
anchovies, mixed with a glass of white wine and a dessertspoonful of
lemon juice. Boil the whole for a couple of minutes, lift out the fish
carefully with a slice, pour the sauce over, and serve it quickly.
Cod fish, 3 lbs.: boiled 5 minutes. Gravy, or strong broth, nearly 1
pint: 5 minutes. Bread-crumbs, 4 tablespoonsful: 3 minutes. Arrow-
root, 1 large teaspoonful; mace, 1/4 teaspoonful; less of cayenne;
essence of anchovies, 1 tablespoonful; lemon-juice, 1
dessertspoonful; sherry or Maidera, 1 wineglassful: 2 minutes.
Obs.—A dozen or two of oysters, bearded, and added with their
strained liquor to this dish two or three minutes before it is served,
will to many tastes vary it very agreeably.
STEWED COD FISH, IN BROWN SAUCE.

Slice the fish, take off the skin, flour it well, and fry it quickly a fine
brown; lift it out and drain it on the back of a sieve, arrange it in a
clean stewpan, and pour in as much good boiling brown gravy as will
nearly cover it; add from one to two glasses of port wine, or rather
more of claret, a dessertspoonful of Chili vinegar, or the juice of half
a lemon, and some cayenne, with as much salt as may be needed.
Stew the fish very softly until it just begins to break, lift it carefully
with a slice into a very hot dish, stir into the gravy an ounce and a
half of butter smoothly kneaded with a large teaspoonful of flour, and
a little pounded mace, give the sauce a minute’s boil, pour it over the
fish, and serve it immediately. The wine may be omitted, good shin
of beef stock substituted for the gravy, and a teaspoonful of soy, one
of essence of anchovies, and two tablespoonsful of Harvey’s sauce
added to flavour it.
TO BOIL SALT FISH.

When very salt and dry, this must be long soaked before it is
boiled, but it is generally supplied by the fishmongers nearly or quite
ready to dress. When it is not so, lay it for a night into a large
quantity of cold water, then let it lie exposed to the air for some time,
then again put it into water, and continue thus until it is well softened.
Brush it very clean, wash it thoroughly, and put it with abundance of
cold water into the fish kettle, place it near the fire and let it heat very
slowly indeed. Keep it just on the point of simmering, without
allowing it ever to boil (which would render it hard), from three
quarters of an hour to a full hour, according to its weight; should it be
quite small and thin, less time will be sufficient for it; but by following
these directions, the fish will be almost as good as if it were fresh.
The scum should be cleared off with great care from the beginning.
Egg sauce and boiled parsneps are the usual accompaniment to salt
fish, which should be dished upon a hot napkin, and which is
sometimes also thickly strewed with chopped eggs.
SALT FISH, À LA MÂITRE D’HÔTEL.

Boil the fish by the foregoing receipt, or take the remains of that
which has been served at table, flake it off clear from the bones, and
strip away every morsel of the skin; then lay it into a very clean
saucepan or stewpan, and pour upon it the sharp Mâitre d’Hôtel
sauce of Chapter IV.; or dissolve gently two or three ounces of butter
with four or five spoonsful of water, and a half-teaspoonful of flour;
add some pepper or cayenne, very little salt, and a dessertspoonful
or more of minced parsley. Heat the fish slowly quite through in
either of these sauces, and toss or stir it until the whole is well
mixed; if the second be used, add the juice of half a lemon, or a
small quantity of Chili vinegar just before it is taken from the fire. The
fish thus prepared may be served in a deep dish, with a border of
mashed parsneps or potatoes.
TO BOIL CODS’ SOUNDS.

Should they be highly salted, soak them for a night, and on the
following day rub off entirely the discoloured skin; wash them well,
lay them into plenty of cold milk and water, and boil them gently from
thirty to forty minutes, or longer should they not be quite tender.
Clear off the scum as it rises with great care, or it will sink and
adhere to the sounds, of which the appearance will then be spoiled.
Drain them well, dish them on a napkin, and send egg sauce and
plain melted butter to table with them.
TO FRY CODS’ SOUNDS IN BATTER.

Boil them as directed above until they are nearly done, then lift
them out, lay them on to a drainer, and let them remain till they are
cold; cut them across in strips of an inch deep, curl them round, dip
them into a good French or English batter, fry them of a fine pale
brown, drain and dry them well, dish them on a hot napkin, and
garnish them with crisped parsley.
TO FRY SOLES.

[In season all the year.]


All fish to fry well must be not only fresh but perfectly free from
moisture, particularly when they are to be dressed with egg and
bread-crumbs, as these will not otherwise adhere to them. Empty,
skin, and wash the soles with extreme nicety, from one to two hours
before they are wanted for table; and after having cleansed and
wiped them very dry both inside and out, replace the roes, fold and
press them gently in a soft clean cloth, and leave them wrapped in it
until it is time to fry them; or suspend them singly upon hooks in a
current of cool air, which is, perhaps, the better method of
proceeding when it can be done conveniently. Cover them equally in
every part, first with some beaten egg, and then with fine dry crumbs
of bread, mixed with a very little flour to make them adhere with
more certainty: a small teaspoonful will be sufficient for two large
soles. Melt in a large and exceedingly clean frying pan over a brisk
and clear fire, as much very pure-flavoured lard as will float the fish,
and let it be sufficiently hot before they are laid in to brown them
quickly; for if this be neglected it will be impossible to render them
crisp or dry. When the fat ceases to bubble, throw in a small bit of
bread, and if it takes a good colour immediately the soles may be put
in without delay. An experienced cook will know, without this test,
when it is at the proper point; but the learner will do better to avail
herself of it until practice and observation shall have rendered it
unnecessary to her. Before the fish are laid into the pan, take them
by the head and shake the loose crumbs from them. When they are
firm, and of a fine amber-colour on one side, turn them with care,
passing a slice under them and a fork through the heads, and brown
them on the other. Lift them out, and either dry them well on a soft
cloth laid upon a sieve reversed, before the fire, turning them often,
or press them lightly in hot white blotting paper. Dish them on a
drainer covered with a hot napkin and send them to table without
delay with shrimp or anchovy sauce, and plain melted butter.
Very small soles will be done in six minutes, and large ones in
about ten. They may be floured and fried, without being egged and

You might also like