Data Structures and Algorithms with JavaScript 1st Edition Michael Mcmillan - Download the ebook with all fully detailed chapters
Data Structures and Algorithms with JavaScript 1st Edition Michael Mcmillan - Download the ebook with all fully detailed chapters
com
https://ebookname.com/product/data-structures-and-
algorithms-with-javascript-1st-edition-michael-mcmillan/
OR CLICK HERE
DOWLOAD EBOOK
https://ebookname.com/product/data-structures-and-algorithms-
in-c-2nd-edition-michael-t-goodrich/
https://ebookname.com/product/problem-solving-with-algorithms-
and-data-structures-using-python-second-edition-bradley-n-miller/
https://ebookname.com/product/clojure-data-structures-and-
algorithms-cookbook-25-recipes-to-deeply-understand-and-
implement-advanced-algorithms-in-clojure-1st-edition-rafik-
naccache/
https://ebookname.com/product/absolute-beginner-s-guide-to-
ebay-2nd-edition-michael-miller/
Law of electronic commercial transactions contemporary
issues in the EU US and China 1st Edition Faye Fangfei
Wang
https://ebookname.com/product/law-of-electronic-commercial-
transactions-contemporary-issues-in-the-eu-us-and-china-1st-
edition-faye-fangfei-wang/
https://ebookname.com/product/introduction-to-conservation-
genetics-1st-edition-richard-frankham/
https://ebookname.com/product/schizophrenia-cognitive-theory-
research-and-therapy-1st-edition-aaron-t-beck/
https://ebookname.com/product/type-1-diabetes-in-children-
adolescents-and-young-adults-how-to-become-an-expert-on-your-own-
diabetes-2nd-edition-ragnar-hanas/
https://ebookname.com/product/porphyry-against-the-christians-
studies-in-platonism-neoplatonism-and-the-platonic-tradition-
robert-m-berchman/
Hiking Wisconsin Second Edition Kevin Revolinski
https://ebookname.com/product/hiking-wisconsin-second-edition-
kevin-revolinski/
www.it-ebooks.info
www.it-ebooks.info
Data Structures and Algorithms
with JavaScript
Michael McMillan
www.it-ebooks.info
Data Structures and Algorithms with JavaScript
by Michael McMillan
Copyright © 2014 Michael McMillan. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or [email protected].
Editors: Brian MacDonald and Meghan Blanchette Cover Designer: Karen Montgomery
Production Editor: Melanie Yarbrough Interior Designer: David Futato
Copyeditor: Becca Freed Illustrators: Rebecca Demarest and Cynthia Clarke
Proofreader: Amanda Kersey Fehrenbach
Indexer: Ellen Troutman-Zaig
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc. Data Structures and Algorithms with JavaScript, the image of an amur hedgehog, and related
trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark
claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.
ISBN: 978-1-449-36493-9
[LSI]
www.it-ebooks.info
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
2. Arrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
JavaScript Arrays Defined 13
Using Arrays 13
Creating Arrays 14
Accessing and Writing Array Elements 15
Creating Arrays from Strings 15
Aggregate Array Operations 16
Accessor Functions 17
Searching for a Value 17
String Representations of Arrays 18
Creating New Arrays from Existing Arrays 18
Mutator Functions 19
Adding Elements to an Array 19
Removing Elements from an Array 20
iii
www.it-ebooks.info
Adding and Removing Elements from the Middle of an Array 21
Putting Array Elements in Order 22
Iterator Functions 23
Non–Array-Generating Iterator Functions 23
Iterator Functions That Return a New Array 25
Two-Dimensional and Multidimensional Arrays 27
Creating Two-Dimensional Arrays 27
Processing Two-Dimensional Array Elements 28
Jagged Arrays 30
Arrays of Objects 30
Arrays in Objects 31
Exercises 33
3. Lists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
A List ADT 35
A List Class Implementation 36
Append: Adding an Element to a List 37
Remove: Removing an Element from a List 37
Find: Finding an Element in a List 38
Length: Determining the Number of Elements in a List 38
toString: Retrieving a List’s Elements 38
Insert: Inserting an Element into a List 39
Clear: Removing All Elements from a List 39
Contains: Determining if a Given Value Is in a List 40
Traversing a List 40
Iterating Through a List 41
A List-Based Application 42
Reading Text Files 42
Using Lists to Manage a Kiosk 43
Exercises 47
4. Stacks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Stack Operations 49
A Stack Implementation 50
Using the Stack Class 53
Multiple Base Conversions 53
Palindromes 54
Demonstrating Recursion 56
Exercises 57
5. Queues. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Queue Operations 59
iv | Table of Contents
www.it-ebooks.info
An Array-Based Queue Class Implementation 60
Using the Queue Class: Assigning Partners at a Square Dance 63
Sorting Data with Queues 67
Priority Queues 70
Exercises 72
6. Linked Lists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Shortcomings of Arrays 73
Linked Lists Defined 74
An Object-Based Linked List Design 75
The Node Class 75
The Linked List Class 76
Inserting New Nodes 76
Removing Nodes from a Linked List 78
Doubly Linked Lists 81
Circularly Linked Lists 85
Other Linked List Functions 86
Exercises 86
7. Dictionaries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
The Dictionary Class 89
Auxiliary Functions for the Dictionary Class 91
Adding Sorting to the Dictionary Class 93
Exercises 94
8. Hashing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
An Overview of Hashing 97
A Hash Table Class 98
Choosing a Hash Function 98
A Better Hash Function 101
Hashing Integer Keys 103
Storing and Retrieving Data in a Hash Table 106
Handling Collisions 107
Separate Chaining 107
Linear Probing 109
Exercises 111
9. Sets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Fundamental Set Definitions, Operations, and Properties 113
Set Definitions 113
Set Operations 114
The Set Class Implementation 114
Table of Contents | v
www.it-ebooks.info
More Set Operations 116
Exercises 120
vi | Table of Contents
www.it-ebooks.info
The Shellsort Algorithm 171
The Mergesort Algorithm 176
The Quicksort Algorithm 181
Exercises 186
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
www.it-ebooks.info
www.it-ebooks.info
Preface
Over the past few years, JavaScript has been used more and more as a server-side com‐
puter programming language owing to platforms such as Node.js and SpiderMonkey.
Now that JavaScript programming is moving out of the browser, programmers will find
they need to use many of the tools provided by more conventional languages, such as
C++ and Java. Among these tools are classic data structures such as linked lists, stacks,
queues, and graphs, as well as classic algorithms for sorting and searching data. This
book discusses how to implement these data structures and algorithms for server-side
JavaScript programming.
JavaScript programmers will find this book useful because it discusses how to implement
data structures and algorithms within the constraints that JavaScript places them, such
as arrays that are really objects, overly global variables, and a prototype-based object
system. JavaScript has an unfair reputation as a “bad” programming language, but this
book demonstrates how you can use JavaScript to develop efficient and effective data
structures and algorithms using the language’s “good parts.”
ix
www.it-ebooks.info
For many programmers who didn’t study computer science in school, the only data
structure they are familiar with is the array. Arrays are great for some problems, but for
many complex problems, they are simply not sophisticated enough. Most experienced
programmers will admit that for many programming problems, once they come up with
the proper data structure, the algorithms needed to solve the problem are easier to design
and implement.
An example of a data structure that leads to efficient algorithms is the binary search tree
(BST). A binary search tree is designed so that it is easy to find the minimum and
maximum values of a set of data, yielding an algorithm that is more efficient than the
best search algorithms available. Programmers unfamiliar with BSTs will instead prob‐
ably use a simpler data structure that ends up being less efficient.
Studying algorithms is important because there is always more than one algorithm that
can be used to solve a problem, and knowing which ones are the most efficient is im‐
portant for the productive programmer. For example, there are at least six or seven ways
to sort a list of data, but knowing that the Quicksort algorithm is more efficient than
the selection sort algorithm will lead to a much more efficient sorting process. Or that
it’s fairly easy to implement a sequential or linear search algorithm for a list of data, but
knowing that the binary sort algorithm can sometimes be twice as efficient as the se‐
quential search will lead to a better program.
The comprehensive study of data structures and algorithms teaches you not only which
data structures and which algorithms are the most efficient, but you also learn how to
decide which data structures and which algorithms are the most appropriate for the
problem at hand. There will often be trade-offs involved when writing a program, es‐
pecially in the JavaScript environment, and knowing the ins and outs of the various data
structures and algorithms covered in this book will help you make the proper decision
for any particular programming problem you are trying to solve.
x | Preface
www.it-ebooks.info
Organization of the Book
• Chapter 1 presents an overview of the JavaScript language, or at least the features
of the JavaScript language used in this book. This chapter also demonstrates through
use the programming style used throughout the other chapters.
• Chapter 2 discusses the most common data structure in computer programming:
the array, which is native to JavaScript.
• Chapter 3 introduces the first implemented data structure: the list.
• Chapter 4 covers the stack data structure. Stacks are used throughout computer
science in both compiler and operating system implementations.
• Chapter 5 discusses queue data structures. Queues are an abstraction of the lines
you stand in at a bank or the grocery store. Queues are used extensively in simulation
software where data has to be lined up before it is processed.
• Chapter 6 covers Linked lists. A linked list is a modification of the list data structure,
where each element is a separate object linked to the objects on either side of it.
Linked lists are efficient when you need to perform multiple insertions and dele‐
tions in your program.
• Chapter 7 demonstrates how to build and use dictionaries, which are data structures
that store data as key-value pairs.
• One way to implement a dictionary is to use a hash table, and Chapter 8 discusses
how to build hash tables and the hash algorithms that are used to store data in the
table.
• Chapter 9 covers the set data structure. Sets are often not covered in data structure
books, but they can be useful for storing data that is not supposed to have duplicates
in the data set.
• Binary trees and binary search trees are the subject of Chapter 10. As mentioned
earlier, binary search trees are useful for storing data that needs to be stored orig‐
inally in sorted form.
• Chapter 11 covers graphs and graph algorithms. Graphs are used to represent data
such as the nodes of a computer network or the cities on a map.
• Chapter 12 moves from data structures to algorithms and discusses various algo‐
rithms for sorting data, including both simple sorting algorithms that are easy to
implement but are not efficient for large data sets, and more complex algorithms
that are appropriate for larger data sets.
• Chapter 13 also covers algorithms, this time searching algorithms such as sequential
search and binary search.
• The last chapter of the book, Chapter 14, discusses a couple more advanced algo‐
rithms for working with data—dynamic programming and greedy algorithms.
Preface | xi
www.it-ebooks.info
These algorithms are useful for solving hard problems where a more traditional
algorithm is either too slow or too hard to implement. We examine some classic
problems for both dynamic programming and greedy algorithms in the chapter.
xii | Preface
www.it-ebooks.info
Safari® Books Online
Safari Books Online is an on-demand digital library that
delivers expert content in both book and video form from
the world’s leading authors in technology and business.
Technology professionals, software developers, web designers, and business and crea‐
tive professionals use Safari Books Online as their primary resource for research, prob‐
lem solving, learning, and certification training.
Safari Books Online offers a range of product mixes and pricing programs for organi‐
zations, government agencies, and individuals. Subscribers have access to thousands of
books, training videos, and prepublication manuscripts in one fully searchable database
from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Pro‐
fessional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John
Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT
Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technol‐
ogy, and dozens more. For more information about Safari Books Online, please visit us
online.
How to Contact Us
Please address comments and questions concerning this book to the publisher:
We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at http://oreil.ly/data_structures_algorithms_JS.
To comment or ask technical questions about this book, send email to bookques
[email protected].
For more information about our books, courses, conferences, and news, see our website
at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Preface | xiii
www.it-ebooks.info
Random documents with unrelated
content Scribd suggests to you:
THE PROJECT GUTENBERG EBOOK OF O.
HENRYANA: SEVEN ODDS AND ENDS,
POETRY AND SHORT STORIES
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.
Title: O. Henryana: Seven Odds and Ends, Poetry and Short Stories
Author: O. Henry
Release date:
April 4, 2020 [eBook #61755]
Most recently updated: October 17, 2024
Language: English
o . h e n r ya n a
seven odds and ends
BY
O. HENRY
1. The Crucible
2. A Lunar Episode
3. Three Paragraphs
4. Bulger’s Friend
5. A Professional Secret
6. The Elusive Tenderloin
7. The Struggle of the Outliers
O. H E N RYA N A
THE CRUCIBLE
“Copy,” yelled the small boy at the door. The sick woman lying on
the bed began to move her fingers aimlessly upon the worn
counterpane. Her eyes were bright with fever; her face, once
beautiful, was thin and pain drawn. She was dying, but neither she
nor the man who held her hand and wrote on a paper tablet knew
that the end was so near.
Three paragraphs were lacking to fill the column of humorous
matter that the foreman had sent for. The small pay it brought them
barely furnished shelter and food. Medicine was lacking but the need
for that was nearly over.
The woman’s mind was wandering; she spoke quickly and
unceasingly, and the man bit his pencil and stared at the pad of
paper, holding her slim, hot hand.
“Oh, Jack; Jack, papa says no, I cannot go with you. Not love you!
Jack, do you want to break my heart? Oh, look, look! the fields are
like heaven, so filled with flowers. Why have you no ice? I had ice
when I was at home. Can’t you give me just a little piece, my throat
is burning?”
The humourist wrote: “When a man puts a piece of ice down a
girl’s back at a picnic, does he give her the cold shoulder?”
The woman feverishly put back the loose masses of brown hair
from her burning face.
“Jack, Jack, I don’t want to die! Who is that climbing in the
window? Oh, it’s only Jack, and here is Jack holding my hand, too.
How funny! We are going to the river tonight. The quiet, broad,
dark, whispering river. Hold my hand tight. Jack, I can feel the water
coming in. It is so cold. How queer it seems to be dead, dead, and
see the trees above you.”
The humourist wrote: “On the dead square—a cemetery lot.”
“Copy, sir,” yelled the small boy again. “Forms locked in half an
hour.”
The man bit his pencil into splinters. The hand he held was
growing cooler; surely her fever must be leaving. She was singing
now, a little crooning song she might have learned at her mother’s
knee, and her fingers had ceased moving.
“They told me,” she said weakly and sadly, “that hardships and
suffering would come upon me for disobeying my parents and
marrying Jack. Oh, dear, my head aches so I can’t think. No, no, the
white dress with the lace sleeves, not that black, dreadful thing!
Sailing, sailing, sailing, where does this river go? You are not Jack,
you are too cold and stern. What is that red mark on your brow?
Come, sister, let’s make some daisy chains and then hurry home,
there is a great black cloud above us—I’ll be better in the morning.
Jack, if you’ll hold my hand tight. Jack, I feel as light as a feather—
I’m just floating, floating, right into the cloud and I can’t feel your
hand. Oh, I see her now, and there is the old love and tenderness in
her face. I must go to her. Jack. Mother, mother!”
The man wrote quickly:
“A woman generally likes her husband’s mother-in-law the best of
all his relatives.”
Then he sprang to the door, dashed the column of copy into the
boy’s hand, and moved swiftly to the bed.
He put his arm softly under the brown head that had suffered so
much, but it turned heavily aside.
The fever was gone. The humourist was alone.
BULGER’ S FRIEND
It was rare sport for a certain element in the town when old Bulger
joined the Salvation Army. Bulger was the town’s odd “character,” a
shiftless, eccentric old man, and a natural foe to social conventions.
He lived on the bank of a brook that bisected the town, in a
wonderful hut of his own contriving, made of scrap lumber,
clapboards, pieces of tin, canvas and corrugated iron.
The most adventurous boys circled Bulger’s residence at a
respectful distance. He was intolerant of visitors, and repelled the
curious with belligerent and gruff inhospitality. In return, the report
was current that he was of unsound mind, something of a wizard,
and a miser with a vast amount of gold buried in or near his hut.
The old man worked at odd jobs, such as weeding gardens and
whitewashing; and he collected old bones, scrap metal and bottles
from alleys and yards.
One rainy night when the Salvation Army was holding a slenderly
attended meeting in its hall, Bulger had appeared and asked
permission to join the ranks. The sergeant in command of the post
welcomed the old man with that cheerful lack of prejudice that
distinguishes the peaceful militants of his order.
Bulger was at once assigned to the position of bass drummer, to
his evident, although grimly expressed, joy. Possibly the sergeant,
who had the success of his command at heart, perceived that it
would be no mean token of successful warfare to have the new
recruit thus prominently displayed, representing, as he did, if not a
brand from the burning, at least a well-charred and sap-dried chunk.
So every night, when the Army marched from its quarters to the
street corner where open-air services were held, Bulger stumbled
along with his bass drum behind the sergeant and the corporal, who
played “Sweet By and By” and “Only an Armor-Bearer” in unison
upon their cornets. And never before in that town was bass drum so
soundly whacked. Bulger managed to keep time with the cornets
upon his instrument, but his feet were always wo-fully unrhythmic.
He shuffled and staggered and rocked from side to side like a bear.
Truly, he was not pleasing to the sight. He was a bent, ungainly
old man, with a face screwed to one side and wrinkled like a dry
prune. The red shirt, which proclaimed his enlistment into the ranks,
was a misfit, being the outer husk of a leviathan corporal who had
died some time before. This garment hung upon Bulger in folds. His
old brown cap was always pulled down over one eye. These and his
wabbling gait gave him the appearance of some great simian,
captured and imperfectly educated in pedestrian and musical
manoeuvres.
The thoughtless boys and undeveloped men who gathered about
the street services of the Army badgered Bulger incessantly. They
called upon him to give oral testimony to his conversion, and
criticized the technique and style of his drum performance. But the
old man paid no attention whatever to their jeers. He rarely spoke to
anyone except when, on coming and going, he gruffly saluted his
comrades.
The sergeant had met many odd characters, and knew how to
study them. He allowed the recruit to have his own silent way for a
time. Every evening Bulger appeared at the hall, marched up the
street with the squad and back again. Then he would place his drum
in the comer where it belonged, and sit upon the last bench in the
rear until the hall meeting was concluded.
But one night the sergeant followed the old man outside, and laid
his hand upon his shoulder. “Comrade,” he said, “is it well with you?”
“Not yet, sergeant,” said Bulger. “I’m only tryin.’ I’m glad you come
outside. I’ve been wantin’ to ask you: Do you believe the Lord would
take a man in if he come to Him late like—kind of a last resort, you
know? Say a man who’d lost everything—home and property and
friends and health. Wouldn’t it look mean to wait till then and try to
come?”
“Bless His name—no!” said the sergeant. “Come ye that are heavy
laden; that’s what He says. The poorer, the more miserable, the
more unfortunate—the greater His love and forgiveness.”
“Yes, I’m poor,” said Bulger. “Awful poor and miserable. You know
when I can think best, sergeant? It’s when I’m beating the drum.
Other times there’s a kind of muddled roarin’ in my head. The drum
seems to kind of soothe and calm it. There’s a thing I’m tryin’ to
study out, but I ain’t made it yet.”
“Do you pray, comrade?” asked the sergeant.
“No, I don’t,” said Bulger. “What’d be the use? I know where the
hitch is. Don’t it say somewhere for a man to give up his own family
or friends and serve the Lord?”
“If they stand in his way; not otherwise.”
“I’ve got no family,” continued the old man, “nor no friends—but
one. And that one is what’s driven me to ruin.”
“Free yourself!” cried the sergeant. “He is no friend, but an enemy
who stands between you and salvation.”
“No,” answered Bulger, emphatically, “no enemy. The best friend I
ever had.”
“But you say he’s driven you to ruin!”
The old man chuckled dryly: “And keeps me in rags and livin’ on
scraps and sleepin’ like a dog in a patched-up kennel. And yet I
never had a better friend. You don’t understand, sergeant. You lose
all your friends but the best one, and then you’ll know how to hold
on to the last one.”
“Do you drink, comrade?” asked the sergeant.
“Not a drop in twenty years,” Bulger replied. The sergeant was
puzzled.
“If this friend stands between you and your soul’s peace, give him
up,” was all he could find to say.
“I can’t—now,” said the old man, dropping into a fretful whine.
“But you just let me keep on beating the drum, sergeant, and maybe
I will some time. I’m a-tryin’. Sometimes I come so near thinkin’ it
out that a dozen more licks on the drum would settle it. I get mighty
nigh to the point, and then I have to quit. You’ll give me more time,
won’t you, sergeant?”
“All you want, and God bless you, comrade. Pound away until you
hit the right note.”
Afterward the sergeant would often call to Bulger: “Time,
comrade! Knocked that friend of yours out yet?” The answer was
always unsatisfactory.
One night at a street corner the sergeant prayed loudly that a
certain struggling comrade might be parted from an enemy who was
leading him astray under the guise of friendship. Bulger, in sudden
and plainly evident alarm, immediately turned his drum over to a
fellow volunteer, and shuffled rapidly away down the street. The
next night he was back again at his post, without any explanation of
his strange behaviour.
The sergeant wondered what it all meant, and took occasion to
question the old man more closely as to the influence that was
retarding the peace his soul seemed to crave. But Bulger carefully
avoided particularizing.
“It’s my own fight,” he said. “I’ve got to think it out myself.
Nobody else don’t understand.”
The winter of 1892 was a memorable one in the South. The cold
was almost unprecedented, and snow fell many inches deep where it
had rarely whitened the ground before. Much suffering resulted
among the poor, who had not anticipated the rigorous season. The
little squad of Salvationists found more distress then they could
relieve.
Charity in that town, while swift and liberal, lacked organization.
Want, in that balmy and productive climate, existed only in sporadic
cases, and these were nearly always quietly relieved by generous
neighbours. But when some sudden disastrous onslaught of the
elements—storm, fire or flood—occurred, the impoverished sufferers
were often too slowly aided because system was lacking, and
because charity was called upon too seldom to become a habit. At
such times the Salvation Army was very useful. Its soldiers went
down into alleys and byways to rescue those who, unused to
extreme want, had never learned to beg.
At the end of three weeks of hard freezing a level foot of snow
fell. Hunger and cold struck the improvident, and a hundred women,
children and old men were gathered into the Army’s quarters to be
warmed and fed. Each day the blue-uniformed soldiers slipped in
and out of the stores and offices of the town, gathering pennies and
dimes and quarters to buy food for the starving. And in and out of
private houses the Salvationists went with baskets of food and
clothing, while day by day the mercury still crouched among the tens
and twenties.
Alas! business, that scapegoat, was dull. The dimes and quarters
came more reluctantly from tills that jingled not when they were
opened. Yet in the big hall of the Army the stove was kept red-hot,
and upon the long table, set in the rear, could always be found at
least coffee and bread and cheese. The sergeant and the squad
fought valiantly. At last the money on hand was all gone, and the
daily collections were diminished to a variable sum, inadequate to
the needs of the dependents of the Army.
Christmas was near at hand. There were fifty children in the hall,
and many more outside, to whom that season brought no joy
beyond what was brought by the Army. None of these little
pensioners had thus far lacked necessary comforts, and they had
already begun to chatter of the tree—that one bright vision in the
sober monotony of the year. Never since the Army first came had it
failed to provide a tree and gifts for the children.
The sergeant was troubled. He knew that an announcement of
“no tree” would grieve the hearts under those thin cotton dresses
and ragged jackets more than would stress of storm or scanty diet;
and yet there was not money enough to meet the daily demands for
food and fuel.
On the night of December the 20th the sergeant decided to
announce that there could be no Christmas tree: it seemed unfair to
allow the waxing anticipation of the children to reach too great a
height.
The evening was colder, and the still deep snow was made deeper
by another heavy fall swept upon the wings of a fierce and shrill-
voiced northern gale. The sergeant, with sodden boots and
reddened countenance, entered the hall at nightfall, and removed
his threadbare overcoat. Soon afterward the rest of the faithful
squad drifted in, the women heavily shawled, the men stamping
their snow-crusted feet loudly upon the steep stairs. After the
slender supper of cold meat, beans, bread, and coffee had been
finished all joined in a short service of song and prayer, according to
their daily habit.
Far back in the shadow sat Bulger. For weeks his ears had been
deprived of that aid to thought, the booming of the big bass drum.
His wrinkled face wore an expression of gloomy perplexity. The Army
had been too busy for the regular services and parades. The silent
drum, the banners, and the cornets were stored in a little room at
the top of the stairway.
Bulger came to the hall every night and ate supper with the
others. In such weather work of the kind that the old man usually
did was not to be had, and he was bidden to share the benefits
conferred upon the other unfortunates. He always left early, and it
was surmised that he passed the nights in his patchwork hut, that
structure being waterproof and weathertight beyond the promise of
its outward appearance. Of late the sergeant had had no time to
bestow upon the old man.
At seven o’clock the sergeant stood up and rapped upon the table
with a lump of coal. When the room became still he began his talk,
that rambled off into a halting discourse quite unlike his usual
positive and direct speeches. The children had gathered about their
friend in a ragged, wriggling, and wide-a-wake circle. Most of them
had seen that fresh, ruddy countenance of his emerge, at the
twelve-stroke of a night of splendour, from the whiskered mask of a
magnificent Santa Claus. They knew now that he was going to speak
of the Christmas tree.
They tiptoed and listened, flushed with a hopeful and eager awe.
The sergeant saw it, frowned, and swallowed hard. Continuing, he
planted the sting of disappointment in each expectant little bosom,
and watched the light fade from their eyes.
There was to be no tree. Renunciation was no new thing to them;
they had been born to it. Still a few little ones in whom hope died
hard sobbed aloud, and wan, wretched mothers tried to hush and
console them. A kind of voiceless wail went among them, scarcely a
protest, rather the ghost of a lament for the childhood’s pleasures
they had never known. The sergeant sat down and figured
cheerlessly with the stump of a pencil upon the blank border of a
newspaper.
Bulger rose and shuffled out of the room without ceremony, as
was his custom. He was heard fumbling in the little room in the
hallway, and suddenly a thunderous roar broke out, filling the whole
building with its booming din. The sergeant started, and then
laughed as if his nerves welcomed the diversion.
“It’s only Comrade Bulger,” he said, “doing a little thinking in his
own quiet way.”
The norther rattled the windows and shrieked around the corners.
The sergeant heaped more coal into the stove. The increase of that
cutting wind bore the cold promise of days, perhaps weeks, of hard
times to come. The children were slowly recovering the sad
philosophy out of which the deceptive hope of one bright day had
enticed them. The women were arranging things for the night;
preparing to draw the long curtain across the width of the hall,
separating the children’s quarters and theirs from those of the men.
About eight o’clock the sergeant had seen that all was shipshape;
and was wrapping his woolen comforter around his neck, ready for
his cold journey homeward, when footsteps were heard upon the
stairway. The door opened, and Bulger came in covered with snow
like Santa Claus, and as red of face, but otherwise much unlike the
jolly Christmas saint.
The old man shambled down the hall to where the sergeant stood,
drew a wet, earth-soiled bag from under his coat, and laid it upon
the table. “Open it,” he said, and motioned to the sergeant.
That cheery official obeyed with an indulgent smile. He seized the
bottom of the bag, turned it up, and stood, with his smile turned to
a gape of amazement, gazing at a heap of gold and silver coin that
rolled upon the table.
“Count it,” said Bulger.
The jingling of the money and wonder at its source had produced
a profound silence in the room. For a time nothing could be heard
but the howling of the wind and the chink of the coins as the
sergeant slowly laid them in little separate piles.
“Six hundred,” said the sergeant, and stopped to clear his throat,
“six hundred and twenty-three dollars and eighty-five cents!”
“Eighty,” said Bulger. “Mistake of five cents. I’ve thought it out at
last, sergeant, and I’ve give up that friend I told you about. That’s
him—dollars and cents. The boys was right when they said I was a
miser. Take it, sergeant, and spend it the best way for them that
needs it, not forgettin’ a tree for the young ’uns, and—”
“Hallelujah!” cried the sergeant.
“And a new bass drum,” concluded Bulger.
And then the sergeant made another speech.
A PROFESSIONAL SECRET
the story of a maid made over
My dearest Ripley:
Do come around this evening—there’s a dear boy—and take
me out somewhere. Mamma has a headache, and says she’ll be
glad to be rid of both of us for a while. ’Twas so sweet of you to
send those pond lilies—they’re just what I wanted for the east
windows. You darling boy—you’re so thoughtful and good—I’m
sure you’re worth all the love of
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com