Data Structures & Algorithms in Python John Canning - Download the ebook now and own the full detailed content
Data Structures & Algorithms in Python John Canning - Download the ebook now and own the full detailed content
com
https://ebookmeta.com/product/data-structures-algorithms-in-
python-john-canning/
OR CLICK HERE
DOWLOAD EBOOK
https://ebookmeta.com/product/data-structures-algorithms-using-kotlin-
second-edition-hemant-jain/
ebookmeta.com
https://ebookmeta.com/product/problem-solving-in-data-structures-
algorithms-using-c-2nd-edition-hemant-jain/
ebookmeta.com
https://ebookmeta.com/product/insight-guides-scandinavia-5th-edition-
insight-guides/
ebookmeta.com
International Relations Theory 1st Edition Mykola
Kapitonenko
https://ebookmeta.com/product/international-relations-theory-1st-
edition-mykola-kapitonenko/
ebookmeta.com
https://ebookmeta.com/product/tiresian-name-inbida-t-
siendiel-01-overview-2400-dpi-first-edition-studio-ammonite/
ebookmeta.com
https://ebookmeta.com/product/analysis-of-composite-laminates-
theories-and-their-applications-1st-edition-dinghe-li/
ebookmeta.com
https://ebookmeta.com/product/captured-by-the-magi-1st-edition-jl-
madore-ruby-night/
ebookmeta.com
https://ebookmeta.com/product/this-pact-is-not-ours-1st-edition-
zachary-sergi/
ebookmeta.com
Singing for Dummies 3rd Edition Pamelia S. Phillips
https://ebookmeta.com/product/singing-for-dummies-3rd-edition-pamelia-
s-phillips/
ebookmeta.com
Data Structures & Algorithms in Python
Data Structures & Algorithms in
Python
John Canning
Alan Broder
Robert Lafore
John Canning
Alan Broder
Contents
1. Overview
2. Arrays
3. Simple Sorting
5. Linked Lists
6. Recursion
7. Advanced Sorting
8. Binary Trees
13. Heaps
14. Graphs
2. Arrays
The Array Visualization Tool
Using Python Lists to Implement the Array Class
The Ordered Array Visualization Tool
Python Code for an Ordered Array Class
Logarithms
Storing Objects
Big O Notation
Why Not Use Arrays for Everything?
Summary
Questions
Experiments
Programming Projects
3. Simple Sorting
How Would You Do It?
Bubble Sort
Selection Sort
nsertion Sort
Comparing the Simple Sorts
Summary
Questions
Experiments
Programming Projects
5. Linked Lists
Links
The Linked List Visualization Tool
A Simple Linked List
Linked List Efficiency
Abstract Data Types and Objects
Ordered Lists
Doubly Linked Lists
Circular Lists
terators
Summary
Questions
Experiments
Programming Projects
6. Recursion
Triangular Numbers
Factorials
Anagrams
A Recursive Binary Search
The Tower of Hanoi
Sorting with mergesort
Eliminating Recursion
Some Interesting Recursive Applications
Summary
Questions
Experiments
Programming Projects
7. Advanced Sorting
Shellsort
Partitioning
Quicksort
Degenerates to O(N2) Performance
Radix Sort
Timsort
Summary
Questions
Experiments
Programming Projects
8. Binary Trees
Why Use Binary Trees?
Tree Terminology
An Analogy
How Do Binary Search Trees Work?
Finding a Node
nserting a Node
Traversing the Tree
Finding Minimum and Maximum Key Values
Deleting a Node
The Efficiency of Binary Search Trees
Trees Represented as Arrays
Printing Trees
Duplicate Keys
The BinarySearchTreeTester.py Program
The Huffman Code
Summary
Questions
Experiments
Programming Projects
13. Heaps
ntroduction to Heaps
The Heap Visualization Tool
Python Code for Heaps
A Tree-Based Heap
Heapsort
Order Statistics
Summary
Questions
Experiments
Programming Projects
14. Graphs
ntroduction to Graphs
Traversal and Search
Minimum Spanning Trees
Topological Sorting
Connectivity in Directed Graphs
Summary
Questions
Experiments
Programming Projects
Structure
Each chapter presents a particular group of data structures and associated
algorithms. At the end of the chapters, we provide review questions
covering the key points in the chapter and sometimes relationships to
previous chapters. The answers for these can be found in Appendix C,
“Answers to Questions.” These questions are intended as a self-test for
readers, to ensure you understood all the material.
Many chapters suggest experiments for readers to try. These can be
individual thought experiments, team assignments, or exercises with the
software tools provided with the book. These are designed to apply the
knowledge just learned to some other area and help deepen your
understanding.
Programming projects are longer, more challenging programming exercises.
We provide a range of projects of different levels of difficulty. These
projects might be used in classroom settings as homework assignments.
Sample solutions to the programming projects are available to qualified
instructors from the publisher.
History
Mitchell Waite and Robert Lafore developed the first version of this book
and titled it Data Structures and Algorithms in Java. The first edition was
published in 1998, and the second edition, by Robert, came out in 2002.
John Canning and Alan Broder developed this version using Python due to
its popularity in education and commercial and noncommercial software
development. Java is widely used and an important language for computer
scientists to know. With many schools adopting Python as a first
programming language, the need for textbooks that introduce new concepts
in an already familiar language drove the development of this book. We
expanded the coverage of data structures and updated many of the
examples.
We’ve tried to make the learning process as painless as possible. We hope
this text makes the core, and frankly, the beauty of computer science
accessible to all. Beyond just understanding, we hope you find learning
these ideas fun. Enjoy yourself!
1. Overview
You have written some programs and learned enough to think that
programming is fun, or at least interesting. Some parts are easy, and some parts
are hard. You’d like to know more about how to make the process easier, get
past the hard parts, and conquer more complex tasks. You are starting to study
the heart of computer science, and that brings up many questions. This chapter
sets the stage for learning how to make programs that work properly and fast. It
explains a bunch of new terms and fills in background about the programming
language that we use in the examples.
In This Chapter
• What Are Data Structures and Algorithms?
• Overview of Data Structures
• Overview of Algorithms
• Some Definitions
• Programming in Python
• Object-Oriented Programming
Some Definitions
This section provides some definitions of key terms.
Database
We use the term database to refer to the complete collection of data that’s
being processed in a particular situation. Using the example of people
interested in tickets, the database could contain the phone numbers, the names,
the desired number of tickets, and the tickets awarded. This is a broader
definition than what’s meant by a relational database or object-oriented
database.
Record
Records group related data and are the units into which a database is divided.
They provide a format for storing information. In the ticket distribution
example, a record could contain a person’s name, a person’s phone number, a
desired number of tickets, and a number of awarded tickets. A record typically
includes all the information about some entity, in a situation in which there are
many such entities. A record might correspond to a user of a banking
application, a car part in an auto supply inventory, or a stored video in a
collection of videos.
Field
Records are usually divided into several fields. Each field holds a particular
kind of data. In the ticket distribution example, the fields could be as shown in
Figure 1-1.
Key
When searching for records or sorting them, one of the fields is called the key
(or search key or sort key). Search algorithms look for an exact match of the
key value to some target value and return the record containing it. The program
calling the search routine can then access all the fields in the record. For
example, in the ticket distribution system, you might search for a record by a
particular phone number and then look at the number of desired tickets in that
record. Another kind of search could use a different key. For example, you
could search for a record using the desired tickets as search key and look for
people who want three tickets. Note in this case that you could define the
search to return the first such record it finds or a collection of all records where
the desired number of tickets is three.
Programming in Python
Python is a programming language that debuted in 1991. It embraces object-
oriented programming and introduced syntax that made many common
operations very concise and elegant. One of the first things that programmers
new to Python notice is that certain whitespace is significant to the meaning of
the program. That means that when you edit Python programs, you should use
an editor that recognizes its syntax and helps you create the program as you
intend it to work. Many editors do this, and even editors that don’t recognize
the syntax by filename extension or the first few lines of text can often be
configured to use Python syntax for a particular file.
Interpreter
Python is an interpreted language, which means that even though there is a
compiler, you can execute programs and individual expressions and statements
by passing the text to an interpreter program. The compiler works by
translating the source code of a program into bytecode that is more easily read
by the machine and more efficient to process. Many Python programmers
never have to think about the compiler because the Python interpreter runs it
automatically, when appropriate.
Interpreted languages have the great benefit of allowing you to try out parts of
your code using an interactive command-line interpreter. There are often
multiple ways to start a Python interpreter, depending on how Python was
installed on the computer. If you use an Integrated Development Environment
(IDE) such as IDLE, which comes with most Python distributions, there is a
window that runs the command-line interpreter. The method for starting the
interpreter differs between IDEs. When IDLE is launched, it automatically
starts the command-line interpreter and calls it the Shell.
On computers that don’t have a Python IDE installed, you can still launch the
Python interpreter from a command-line interface (sometimes called a terminal
window, or shell, or console). In that command-line interface, type python and
then press the Return or Enter key. It should display the version of Python you
are using along with some other information, and then wait for you to type
some expression in Python. After reading the expression, the interpreter
decides if it’s complete, and if it is, computes the value of the expression and
prints it. The example in Listing 1-1 shows using the Python interpreter to
compute some math results.
$ python
Python 3.6.0 (default, Dec 23 2016, 13:19:00)
Type "help", "copyright", "credits" or "license" for more information.
>>> 2019 - 1991
28
>>> 2**32 - 1
4294967295
>>> 10**27 + 1
1000000000000000000000000001
>>> 10**27 + 1.001
1e+27
>>>
In Listing 1-1, we’ve colored the text that you type in blue italics. The first
dollar sign ($) is the prompt from command-line interpreter. The Python
Discovering Diverse Content Through
Random Scribd Documents
know how long and how ardently I have loved you; may I not, one
day, drop that epithet of Cousin?" Tony looked at Kate for some
reply. "Cousin Tony," said Catherine, summoning up all her courage,
"we can never be more than friends and cousins." Then Kate's brow
began to cool, but whenever Tony would press the matter, all he saw
was new blown blushes, for Kate had seen that Tim's eyes were
fastened upon her, and from Tony's eager gaze and manner, she well
knew a stranger's suspicions must be roused.
Gentle reader, I have told you thus much of Tony's courtship, that
you, as well as Tim, might see a few of Katy's blushes. She was as
delicately refined in thought and sentiment as you can possibly
conceive. Her's was
so soft, and thin, and white, that you might perceive each pulse as it
ebbed and flowed; indeed, whenever her heart was excited by any
sudden emotion, the delicate ruby would come and go, till the
consciousness of blushing would make her doubly crimson. She
would endeavor to conceal her emotions,
All this time, Tim, that most notorious contemner of beauty, and the
man of all others who could most manfully resist loveliness, "in any
shape, in any mood," sat drinking in these unconscious exhibitions of
Katy's character and mind. He saw not Tony, much less did he hear
or imagine what he said. All he perceived was Catherine's face, and
those rich, floating curls. It was indeed cruel in Cupid to place him
there. At every succeeding blush, a poisoned arrow flew from his
silver bow, and Tim's poor heart fluttered in his bosom. Determining
for once, however, to out general Cupid, Tim gallantly resolved upon
a hasty flight; accordingly, he took himself across the little bridge,
and began sauntering away on the opposite hill.
About the same time, Catherine again insisted upon returning, and
Tony finding all effort at persuasion perfectly hopeless, began to put
upon the matter the best face he could muster. Taking his cousin's
arm he insisted she should vary the walk, by crossing to the other
side of the canal, and return to the city in that direction. Kate
expressed her uneasiness at crossing this insecure bridge, but as
Tony was importunate, she reluctantly consented, not desiring
farther to add to his mortification by a positive refusal. Tony, as a
man of gallantry naturally would do, placed Catherine upon the
soundest of the logs, he himself walking by her side on the weaker
of the two, not reflecting that the weaker log would much more
easily bear her weight than his. As fate would have it, Catherine
became alarmed by the trembling of the bridge, and leaned the
more heavily upon Tony for support, and as he was not in a mood to
care much whether he broke his own neck or not, he insisted upon
proving to his cousin, that the bridge was perfectly secure, and that
all her fears were totally groundless. So taking her by the arm, in a
careless way, and telling her gaily, "Now mind what you are about,"
he raised himself upon his feet several times, so as to produce an
oscillating motion in the log. At this moment, Tim had turned about
to cast one lingering look, merely to inquire with himself, what lassie
that might be, when perceiving the danger they were in, he shouted
at the top of his voice, "Take care!"—but it was too late,—down
went the log with a terrible crash, and poor Tony and sweet Kate
were precipitated into the water below, in the middle of the canal, at
the deepest point. If ever you have seen in the hand of some
ruthless urchin, an innocent bird (which he has just succeeded in
securing from his trap,) flurried, gasping and panting with fright, you
will have a correct idea of Katy. She gave one shriek as she fell, and
then rose almost breathless, gasping and panting in an agony of
alarm. Luckily the water was not more than waist deep. Tony went
down feet foremost, following the decayed timbers, (pity he had not
fallen on his head,) but Catherine, clinging to his arm at the time of
the accident, and having her support suddenly taken from her, was
precipitated at full length into the water. In an instant, Tim rushed to
the spot. Into the canal he went, and catching the terrified Kate in
his arms, he brought her safely to the shore. Tony did all he could,
but poor fellow he was completely involved among the broken
fragments, and though he strove to rescue Kate, it was as much as
he could do to extricate himself. Tim knew there was no danger of
Tony's drowning, and so he left him to struggle for himself, giving all
his attention to Kate, who was truly an object worthy of his care,
and yet not the less of his admiration. She, though thoroughly wet,
withal looked so grateful, and her countenance expressed so many
thanks, and her pitiable situation, together with the freshness of the
water, heightened the bloom of her cheek to such a degree, that Tim
never once noticed her dress. Well might he have imagined her the
beauteous Goddess Thetis, with her silvery drapery, as she issued
from her watery mansion. But when she took off her fragile bonnet,
to adjust her dishevelled hair, and he viewed
who could have blamed him, if he had given way to his raptures,
and exclaimed,
As for Tony, if you could have seen him, as he crept out of the water,
with his "long tailed blue," tapering to a point, and dripping like an
old rooster under a cart, on a rainy day, with his head up and his tail
down, you really would have pitied him; he knew not which way to
look, nor what to say. I have seen a dog caught in the act of killing
sheep; have seen a wet rat creeping out of a tub; and I saw the gay
Tony sneaking out of the canal after having been turned off by his
sweetheart, and each of these animals, dog, rat, and Tony, had the
same identical sickly phiz. The dog slunk to his kennel, the rat crept
to his hole, but Tony was forced to his mistress, who with all
imaginable sweetness forgave him in an instant. He ought, if he
could, to have crept into an augur hole and hid himself there forever.
However, finding Tim was an old friend of his, he thanked him kindly
for his timely assistance, and introduced him to her, of all others,
with whom Tim most desired some farther acquaintance.
In a little time, our three friends began to laugh the matter over as
well as they could, and being thoroughly drenched, they endeavored
to keep each other in countenance, on their way homeward. Tim
accompanied Kate to her door, and then, wishing she might
experience no farther inconvenience from her accident, and having
received a polite invitation to visit the family, retired with Tony to
procure a drier suit.
My kind reader, you must listen to me with patience; hereafter, I will
not ramble so much at large, but will hasten on with my story.
Time's magic wing sped on, and days, weeks and months rolled by.
In the mean time, Tim continued his visits to Kate. Sometimes, at an
interval of a fortnight; at other times but a week would elapse; then
this short week began to appear an entire month; finally, weeks
were reduced to days, and days to hours, and Tim was not satisfied
unless he paid a visit at least twice a day.
The gossips of the city were thus furnished with a new theme to run
riot with, and Tim and Catherine were bandied about at a merciless
rate. Some thought it passing strange—others thought it natural
enough. "Did you hear Mr. Wilberforce was courting?" said one; "Did
you know Miss Catherine was engaged?" said another; "I'll bet my
life they will be married!" "I know she has turned him off!" "She will
never have him in the world," said a third, "for she is already
engaged to her cousin Tony." And thus, Tim was known to be
courting, engaged, turned off and jilted, before he himself had
ascertained what his fate would be; but the latter opinion, that he
was certainly turned off, gained the more currency, particularly as
our friend was suddenly called off, by business, to a distant city,
where he was compelled to remain for several months. The busy
bodies could not but notice, with what a heavy heart he departed,
and there could be no possibility of doubt about it. Tim had certainly
received his walking papers. No matter, friend Tim, thou must learn
Most persons would suppose, that after the honest denial, and the
decent ducking Tony had obtained, that the ardor of his love would
have been somewhat cooled, and that he would have been the last
person who would ever have attempted again to mention love in
Catherine's presence. Not so, Tony. He had been more than once
rejected already by his cousin, but because they were cousins, and
Catherine had always treated him kindly, Tony was still induced to
harbor hope, when almost any other person would only have
welcomed despair. He found it impossible "to look and not to love."
He was one of those luckless wights, who love and are not beloved,
and yet cannot bring themselves to give up the loved object—who,
though driven from the presence of their fair ones, continue to cast
a lingering look behind, to catch a glimpse of relenting compassion.
He reminded me of the glowing description of Lot's wife, once given
by an humble divine, when he endeavored to explain to his flock
why it was that she continued to look back as she fled from the ill-
fated Sodom. "Ah, my brethren," he said, "no doubt the good
woman had a pleasant little garden there, filled with all kinds of
vegetables, and the remembrance of her greens, and her turnips,
her potatoes, tomatoes, her squashes and beans, about which she
had experienced many moments of anxiety and vexation, caused her
heart to cling to the world, and so from the top of every little knob,
she looked,—and looked,—and there she stands, a pillar of salt." If
Tony but received a look of recognition, it was sufficient
encouragement for him. If he accidentally received a civil bow, in
return for a gracious smile, he would imagine himself welcomed to
her arms. If he offered his hand, and she did not put her arms
akimbo, and look like a very virago, he would return the next
morning, and if he was again told of friendship merely, Tony would
only express his astonishment, and say, "Why then did you give me
such encouragement,—why did you look in that way?" Look in that
way! Now the fact is, no matter which way Catherine might have
looked, it would have been all the same to Tony. If she looked mild
and placid, or fierce and acid; if she had been pensive and musing,
or laughing and romping; had she looked out of her right eye
athwart her nose, or out of her left athwart her shoulder, or had she
not looked at all, "like Paddy, when he shut his eyes to peep in the
glass, to see how he looked when asleep," Tony would have
discovered ample cause for indulging in hope in each smile, frown,
curl of the lip, or play of a muscle. But though, continuing in the
same hopeless condition, he always consoled himself by saying,
"She gaz'd as I slowly withdrew,
My path I could hardly discern,
So sweetly she bade me adieu,
I thought that she bade me return."
Time still moved onward. And Catherine still attracted and received
the admiration of all who beheld her. One day, as she was seated
alone in her parlor, in a somewhat melancholy mood, (for it was a
rainy, dreary day,) with a book in her hand, her back to the door, and
her head leaning against the sash of the window, she began to hum
to herself a little song a friend had lately given her. She would sing a
line or two, and pause,—and then again would raise her mellow
voice.
And this was sung with so much feeling, you could plainly see her
heart had given utterance to its inmost sentiments. Her singing was
so sweet, we might truly say,
The notes however died away, and Kate still sat in a seeming
reverie. When we are fairly in one of these musing moods, we will sit
for hours, without being able to tell upon what object our eyes or
thoughts have been so keenly rivetted. Our senses seem to be
closed against ordinary impressions. At any rate, while Catherine
continued thus leaning, some one walked lightly into the room, and
discovering he was not noticed, gently placed his hands over her
eyes without speaking.
Reader, you have seen blushes! Had you been with me that day, you
would have witnessed "smiles playing with dimples, suffused with
blushes, Aurora alone could rival." You would have seen surprise and
joy chasing away sorrow from a pensive brow; and from the "joy
sparkling in their dark eyes like a gem," you would have sworn that
these were acknowledged lovers.
Who do you think could have thus intruded and taken such a liberty,
other than cousin Tony? It was our old friend Timothy Wilberforce,
returned from his travels.
Now, you must understand, that for some cause, I never could
divine what, aunt Tabby had taken up a mortal antipathy to our
friend Tim; indeed, she was his evil genius, and she always
managed to step in, at the very moment of all others, when her
company was least desired. If he paid a morning visit, and the rest
of the family kindly dropped off one by one, (each, by the bye,
making a lame excuse for his or her absence,) just as Tim would
draw up his chair close along side, and begin those endearments,
which all know how to use, but few to express,
in would pop aunt Tabby, and down she would sit, like a cat at a
hole, and sit there for hours. Oh how Tim's heart would sicken. If he
made an evening call, and sat till all the family retired to repose,
good aunt Tabby did not think it proper for young ladies to be left
alone with young gentlemen; such things were not tolerated in her
day. Thus did the old lady keep her nightly vigils, rattling away about
ten thousand fooleries, and fretting honest Tim more than a legion
of devils, and at last, after vainly spending the evening, the poor
fellow would slowly depart, growling smothered curses:
"So turns the lion from the nightly fold,
Though high in courage, and with hunger bold,
Long galled by herdsmen, and long vex'd by hounds,
Stiff with fatigue, and fretted sore with wounds:
The darts fly round him from an hundred hands,
And the red terrors of the blazing brands:
'Till late, reluctant, at the dawn of day,
Sour he departs, and quits the untasted prey."
Some readers will say, "what difference would it make if aunt Tabby
was present?" I set all such down as utter boobies; for if any one
could carry on a courtship, or after engagement could carry on a
conversation with his intended, when the "Mother of Vinegar" was
present, in the shape of an old maid, and that old maid a sworn
enemy, I would unhesitatingly pronounce, that Cupid had nothing in
the world to do with the matter.
At the present juncture, the first intimation the old lady had of the
matter, was afforded her by an army of carpenters, bricklayers,
stone-masons and painters, scaling her house with ladders and
scaffolds, and turning the whole concern, topsy turvy, from the
garret to the cellar. Here ran the painters devils, rubbing every thing
with sand paper; there shouted the bricklayer, "mortar! bricks here!"
Here whistled the carpenter, and jarred the old timbers with his
hammer, banging and whacking away with the force of a giant.
"In the name of common sense," said the old lady, "good people
what do you mean?" If ever you saw a hen fluttering when a hawk
made a sudden dart at one of her brood, you would have some idea
of the old lady on this memorable occasion. It was as plain as the
nose in her face, that something was to pay, and she half suspected
what it was; but that Tim should go to work without any
consultation was unaccountable, and more than that, it was
unreasonable. She hallooed for Tim; he was not forthcoming. She
asked the carpenter what he was about? "Mr. Wilberforce had
ordered him to mend every thing that required mending." She
inquired of the bricklayer what he was doing? "Mr. Wilberforce told
him to cap the chimnies, relay the hearths and mend the whole
concern." She asked the painter what he meant by all this
preparation? "Mr. Wilberforce sent him to paint the house all over."
"You must have made a mistake in the house," said Tim's mother.
"No—there was no mistake. It was to be done, and in the best style,
and in the shortest possible time." The old lady packed off the
servants in all directions for Tim, and in the mean time continued
fluttering about, stowing away this thing and that thing, into this
hole and that cuddy, until she had fatigued herself into a perfect
fever. At length, Tim arrived. "My dear son," said she, "what in the
world has got into you? Do you mean to ruin yourself, Tim?"
"Mother," says Tim, kindly, "I told you I was going to be married."
"No you did'nt." "Well, I tell you so now, and I think our house wants
a little furbishing." Now, the old lady had frequently of late, been
charging Tim with being in love with Kate, and though he never
exactly denied it, yet he never had admitted it; and though she had
no decided objection to the match, yet she never had made up her
mind to it, and therefore she seated herself and began to cry. She
did'nt ask Tim, who he was to marry? Where the young lady lived?
What she was like? Whether she had a fortune or not? But she sat
down, as one bereft of all hope, and tuned up her pipes. Alas for
Tim! He had been too precipitate. Such matters require some
introduction.
The truth was, nothing could give the old lady so much happiness,
as to contribute in any way to Tim's comfort and felicity, or to know
that he was happy; but then, she and Tim had lived so long
together, now that he was going to be married, it seemed to her as
though she and he were to be divorced forever, and a thousand
conflicting feelings rushed into her bosom. Tim asked his mother if
she was dissatisfied with the match? "No," she said, in a tone of
inextinguishable grief, and then burst forth into fresh weeping.
Now, gentle reader, I have told you that the painters were making
terrible preparations for their work, and while Tim and his mother
were engaged, as we have just seen,—he, endeavoring to soothe
the old lady's unreasonable and ill-timed grief, and she, exhibiting as
much woe as she could possibly have done, had Tim been wrapped
in his winding sheet before her,—one of these aforesaid daubers
kept continually passing in and out at the door, until he had heard
enough to satisfy him that Tim was going to be married, and that
the old lady was most vehemently opposed to the match. He had
not heard her deny her opposition, but he had seen and heard her
weepings and wailings, which convinced him that she would never
consent to the match in the world. So, on his way home that day, he
happened to meet his cousin Patsy Wiggins, and stopping her in the
street,—"Did you know, cousin Patty, that young Mr. Wilberforce is
going to be married?" said brushy. "But I tell you what, it has kicked
up a terrible rumpus. I just left the old lady, breaking her heart
about it, and poor Mr. Tim is in a peck of troubles." Brushy went his
way, and so did cousin Patty, but meeting her dear friend Miss
Deborah Dobbins, as she was gossiping about the neighborhood;
"Ah, my dear Deb," says she, "have you heard the news? Old Mrs.
Wilberforce says, she will see her son in his grave, before she will
give her consent to his marrying, and what's more, Miss Catherine
Turberville shall never darken her doors while her head is hot. You
may rely upon it, they will have monstrous work of it." So off posted
the friendly Deborah Dobbins, to visit her crony, good Miss
Catherine's dear aunt Tabby. "Aunt Tabby," said Deb, "I am afraid I
have bad news to tell you." "What is it child?" "I know it will distress
you to hear it, but Mrs. Wilberforce has just heard that her son and
your niece are engaged, and she has told her son, in the most
peremptory manner, that her family shall never be disgraced by such
a connexion—that your niece is beneath his notice, and if he does
not break off the match immediately, he never more shall see her
face. Now, Mr. Tim swears he will marry her in spite of all opposition,
and so the whole house is in an uproar. If I were Kate, I'd let them
know who was disgraced."—"Beneath them!" said aunt Tabby,
turning up her nose until it nearly twisted over the back of her head
—"Beneath them, indeed!" "Darken her doors!" "She disgraced by
my niece!" "She!"
Gentle reader, you may readily imagine what else these good people
said and devised; but while this tale was going the rounds, gathering
as it rolled, Tim had entirely reconciled his mother to his intended
marriage, and as he unfolded his little plans, for his own and her
future comfort, the old lady cheered up and resumed her wonted
good humor.
The next day, Tim as usual, called to see his dearest Catherine, but
he was told she was not at home that morning. In the evening he
called again. "Miss Catherine was so unwell, she had taken to her
bed." Early the day after, Tim called to inquire how Catherine was.
"Tell Miss Catherine," said Tim, "I called to see her, and hope she is
better." Tim rambled about the lower part of the house. "Miss
Catherine was not so well." In this way, Tim called for several days,
vainly hoping to see his Kate, or at any rate to receive some kind
word or message. At last, he was honored with the following letter.
"I hope Mr. Wilberforce will pardon me for having denied myself
so often. At first, it was to me as painful as it could have been
to him, but if he knew the reason which prompted the course I
have adopted, he could not fail to applaud, what he now, no
doubt, condemns. In determining not to see him again, I have
consulted not only his peace, and the felicity of those dearest to
him, but I am convinced, my own happiness also. My reasons
would satisfy the most scrupulous—but as I cannot divulge
them, I must bear the scoffs of the world, for the fickleness and
coquetry which my conduct apparently justifies. I hope my
friend will bear this blow with becoming fortitude. The
determination I have made is painful to myself, but it is
irrevocable. If it will afford my friend any satisfaction to know,
that nothing that he has said or done, has produced this sudden
change in my purposes, I freely acknowledge the fact. He is in
every respect worthy of the best and loveliest. Forgive me, as
freely as I acquit you. Our engagement is terminated.
CATHERINE TURBERVILLE."
During the very cold weather which ushered in our last spring, I was
one night sitting in my dormitory, before a blazing fire, luxuriating in
that most selfish of all pleasures, vulgo a "brown study." There was
something so indescribably comfortable in my situation, that,
although I had half a dozen unprepared lectures for the next
morning staring me in the face, I found it a matter of utter
impossibility to open a text book, still less to direct my attention
even for the shortest time to its contents. Stretched in my capacious
arm chair—my feet toasting before the aforesaid blazing fire—I lay
listening with a dreamy sort of consciousness, to the continual, dull,
unceasing hum of the falling snow. Regardless and entirely
independent of the cold and storm without, my eyes fixed on the
fanciful figures, changeable as the images of the Kaleidescope,
which the burning coals assumed—in a word, settled in that position,
a description of which has been so often attempted—and which
every man who has one particle of soul about him has often and
oftentimes enjoyed, I fell into a long train of reflections as absorbing
and delightful as they were false and illusory. The future—the
present—the past—castles in the air—my far distant home—were the
most prominent and strongly marked images in the scenes which
flitted across the magic mirror of my fancy.
I know not how long I had been in this situation, when my dreaming
was suddenly interrupted in a most singular manner. My tongs,
which were but little removed from the direct line of my vision,
seemed suddenly to become extremely uneasy. The simple,
unoffending tongs, which, except when used, had quietly occupied
their allotted station in the corner during the whole session,
appeared to be seized with a strange propensity for locomotion, and
at the same time to be altering the figure of their outward self in a
manner singular, wonderful, unaccountable. The general appearance
—the "tout ensemble" was, it is true, nearly the same, but still there
seemed to have been effected a certain change, which attracted my
wandering attention rather more immediately towards them. You
may smile perhaps, and say that either I was rather light headed, or
that I was neither more nor less than dreaming in reality. But there
before my eyes, which were as wide awake as they are at this
moment, upon the round knob which I had so often and so
unceremoniously grasped, was as quaint and humorous a face as
ever came from the pencil of Hogarth. A slight glance now gave me
an insight into the whole figure. Imagine the long spindle legs cased
in a pair of rusty looking "shorts"—the body, what little there was of
it, surrounded by one of those comfortable old garments, which
have been, not inaptly denominated quaker coats—and the rest of
the clothing in strict keeping with a style which, all who can
recollect, or even have heard much of the good old days of our
grandfathers, will at once recognise. Just imagine, I say, this odd
figure, thus garmented up, and you will form a good idea of the
general appearance of my visiter—(For I cannot believe it was the
same boná fide pair of tongs, which are now so peacefully reposing
before me.) The first glance was sufficient for an introduction. A
slight start on my side, and a familiar "at home" sort of nod on his—
and all was settled. His first motion was to seat himself on my
fender, where he deliberately crossed his legs—his first remark was
on the subject that last engaged my thoughts. A voice sweet and
delightful as the first waking notes of distant serenade, but perfectly
full and distinct, stole over my enraptured senses.
"And now examine each and decide for yourself, which you will
choose as the scene of your future efforts—choose, and pursue that
choice with determination. One road alone can you follow. Some, it
is true, have, when tired of the one, pursued the other for a time.
But no man ever reached the top of both. You are then to decide in
favor of one, and having decided, steadily to pursue it, or content
yourself with remaining unnoticed in the crowd which fills the plain
beneath. That you may form your decision more correctly, look into
the history of those who have sought and gained pre-eminence, in
either kind of fame. Let us then (laying aside our metaphors) judge
from past history, and by that let your future course be decided. In
the histories of those who have even stood highest as writers, poets,
&c. you often find much calculated to disgust you with the pursuit
which they followed—how little do you find to envy in the lot of the
beggar Homer—the blind and half starved Milton—the miserable
Otway dying, choked with the morsel of food which he had begged
of a friend; Goldsmith, Johnson, &c. It is true, that in contrast to
these we may name Newton, Bacon, Shakspeare, Byron, who
succeeded in gaining during (and some of them early in) their lives
the fame they so eagerly sought. But more numerous are the
instances on record, where literary merit has been unrewarded
except by posthumous renown. Of genius the most brilliant—of
minds the most powerful, which have gained their hard earned mede
of praise—when their bodies were mouldering in the grave—when
the head which conceived, and the hand which penned their bright
aspirations, as well as the heart which so ardently beat for glory and
honor—have mingled with the dust, alike unmindful and indifferent
to praise or reproach, to fame or obloquy. When the bright etherial
spirit, which once so strongly throbbed for a 'name among men,' has
taken its flight to a truer home, where the glory of this world is
nothing—then is paid to the memory the honor which the man
deserved—which would have made him so completely happy. His life
perhaps was spent in grinding poverty, in misery and wretchedness,
imbittered by that chill cold neglect of the world, which so withers
the sensitive heart—for what? A name after death. Let us turn from
this dismal picture, to the other. Here at least, are some substantial
pleasures, however they may be alloyed by the attendant evils,
dangers and difficulties. Here at least, honor is nearly always
rendered, if bestowed at all, whilst it can be appreciated. And now
let us see whether the dangers and difficulties I have mentioned,
may not be really less than we were at first inclined to believe them,
and whether with care they may not be almost entirely avoided. It is
true, that he who once becomes a public servant, throws his
character in the hands of every man, and lays himself open to the
attacks of every scribbler. He is exposed to the malicious accusations
of men, who are neither able nor anxious to see his actions in their
true light; his slightest faults held up on high to become marks of
scorn among men—buts at which every vindictive slanderer may
wing a poisoned shaft—even his very virtues distorted and perverted
till they become in appearance vices. This I grant, is the life which all
public men must lead; but let not this picture startle you. If really
innocent, he will rise above the abuse which is poured upon him.
Confident in the great decision of a candid world, he is superior to
this sort of scandal. And have we not reason to believe that here as
in other cases, custom renders one indifferent to that which at first
would make him miserable? And that the most sensitive mind may
soon begin to look on these as troublesome insects, which may at
the time incommode, but which should create no lasting
disturbance. The best proof of this, as I have before told you is, that
men who have succeeded at all in public life, will, however
disagreeable it may appear, cling to it as strongly as if in this, lay the
very light of their existence. How sweet it is to have one's name in
the mouths of all—to be the theme of admiration and wonder with
the crowd—to have power. But there is even a purer and better
enjoyment. How perfect the pleasure which animates the bosom of
the statesman when he knows that to his talents—to his efforts—
millions are indebted for their greatest comforts—that a whole
nation looks up to him as their benefactor—that through his
means"——
TO MRS. ——,
Whose husband was absent in the United States Navy. On seeing her in a gay company.
GENERAL WARREN.
STORIES ABOUT GENERAL WARREN—By a Lady of Boston, 1835, pp. 112, 12mo.
"In her old age, when her own children had left her fireside, it was one of her dearest
pleasures to gather a group of their children, or of the children of others around her.
She did all in her power to promote their enjoyment, and her benevolent smile was
always ready to encourage them. On Thanksgiving-day,1 she depended on having all
her children and grand children with her; and until she was 80 years of age, she
herself made the pies with which the table was loaded! Not satisfied with feasting
them to their heart's content while they were with her, she always had some nice
great pies ready for them to take home with them."
Joseph's education, till his fourteenth year, was at the public school
in Roxbury; one of those common schools, which, from the earliest
times of New England, have been planting and nurturing in her soil
the seeds and shoots of virtue and freedom. Even in boyhood, our
hero was manly, fearless and generous: always taking the part of his
weaker school-fellows against a strong oppressor—always the
When the British Parliament and Crown began, in 1764, that course
of unconstitutional legislation, which was destined, after eleven
years of wordy war, to end in a war of blood, Dr. Warren was among
the first to stand forth for the rights of America—to assert, and to
labor in demonstrating to his countrymen, that the power to tax
them (claiming, as they did, all the liberties of Englishmen) could not
exist in a government of which no representatives of theirs formed a
part. Fostered by him, and by others like him, the spirit of resistance
to tyranny grew daily more strong. The inhabitants of the whole
country, and especially of Boston, gave token after token of their
fixed resolve, to spurn the chain which they saw preparing for them.
In 1768, Col. Dalrymple with two royal regiments, reinforced
afterwards by additional troops, entered that devoted town, with
more than the usual "pomp and circumstance" of military bravado;
and there remained in garrison, to repress what the king and
ministry were pleased to call "the seditious temper" of the people.
Never was attempt at restraint more impotent; nay, more suicidal.
The curb, feebly and capriciously or unskilfully plied, served but to
infuriate the noble animal it was meant to check and guide: and no
wonder that the rider was at length unseated, and stretched in the
dust. The New Englanders—we should rather say, the Americans—
were too stubborn to be driven, and too shrewd to be circumvented.
Every measure of tyranny, they met with an appropriate measure of
resistance. Tea had been brought from India, to be the vehicle of
unconstitutional taxation. They threw part of it into the sea; another
part they hindered from being landed; and the remainder they
excluded from use, by mutual pledges to "touch not, taste not" "the
unclean thing." Judges were sent over to judge them—creatures of
the king—the panders of ministerial oppression. The people would
not suffer them to mount the judgment seat—closed the court
houses—referred all their differences to arbitrators chosen by the
parties—and even so far tamed the spirit of litigation and disorder,
as to make tribunals of any sort in a great degree needless.2
Between the British troops and the Boston people, animosities soon
ran high. The soldiers seized every opportunity to exasperate the
people: the people assembled in mobs, to revenge themselves on
the soldiers. Amidst these tumults, Dr. Warren repeatedly exposed
his life to soothe and restrain his countrymen. His eloquent
persuasions were generally successful. At first, the more violent
would endeavor to repel him, and would clamor to drown his voice.
"While they did this, he would stand calmly and look at them. His
intrepidity, his commanding and animated countenance, and above