How to Think About Algorithms 1st Edition Jeff Edmonds - The full ebook version is ready for instant download
How to Think About Algorithms 1st Edition Jeff Edmonds - The full ebook version is ready for instant download
com
https://ebookname.com/product/how-to-think-about-
algorithms-1st-edition-jeff-edmonds/
OR CLICK HERE
DOWLOAD EBOOK
https://ebookname.com/product/how-to-think-about-information-1st-
edition-dan-schiller/
https://ebookname.com/product/essaying-the-past-how-to-read-
write-and-think-about-history-2nd-edition-jim-cullen/
https://ebookname.com/product/how-to-think-logically-1st-edition-
gary-seay/
https://ebookname.com/product/treatment-wetlands-second-edition-
robert-h-kadlec/
Handbook of Early Pregnancy Care 1st Edition Thomas H.
Bourne
https://ebookname.com/product/handbook-of-early-pregnancy-
care-1st-edition-thomas-h-bourne/
https://ebookname.com/product/zollikon-seminars-protocols-
conversations-letters-1st-edition-martin-heidegger/
https://ebookname.com/product/atls-advanced-trauma-life-
support-10th-edition-student-course-manual-committee-on-trauma/
https://ebookname.com/product/revival-benzene-
carcinogenicity-1988-first-edition-aksoy/
https://ebookname.com/product/wireless-networks-1st-edition-
georgios-i-papadimitriou-2/
The Pinochet File A Declassified Dossier on Atrocity
and Accountability Second Edition Peter Kornbluh
https://ebookname.com/product/the-pinochet-file-a-declassified-
dossier-on-atrocity-and-accountability-second-edition-peter-
kornbluh/
This page intentionally left blank
P1: KAE Gutter margin: 7/8 Top margin: 3/8
CUUS154-FM CUUS154-Edmonds 978 0 521 84931 9 April 2, 2008 17:52
There are many algorithm texts that provide lots of well-polished code and
proofs of correctness. Instead, this one presents insights, notations, and
analogies to help the novice describe and think about algorithms like an
expert. It is a bit like a carpenter studying hammers instead of houses. Jeff
Edmonds provides both the big picture and easy step-by-step methods for
developing algorithms, while avoiding the comon pitfalls. Paradigms such
as loop invariants and recursion help to unify a huge range of algorithms
into a few meta-algorithms. Part of the goal is to teach students to think
abstractly. Without getting bogged down in formal proofs, the book fosters
deeper understanding so that how and why each algorithm works is trans-
parent. These insights are presented in a slow and clear manner accessible
to second- or third-year students of computer science, preparing them to
find on their own innovative ways to solve problems.
Abstraction is when you translate the equations, the rules, and the under-
lying essences of the problem not only into a language that can be commu-
nicated to your friend standing with you on a streetcar, but also into a form
that can percolate down and dwell in your subconscious. Because, remem-
ber, it is your subconscious that makes the miraculous leaps of inspiration,
not your plodding perspiration and not your cocky logic. And remember,
unlike you, your subconscious does not understand Java code.
i
P1: KAE Gutter margin: 7/8 Top margin: 3/8
CUUS154-FM CUUS154-Edmonds 978 0 521 84931 9 April 2, 2008 17:52
ii
P1: KAE Gutter margin: 7/8 Top margin: 3/8
CUUS154-FM CUUS154-Edmonds 978 0 521 84931 9 April 2, 2008 17:52
JEFF EDMONDS
York University
iii
CAMBRIDGE UNIVERSITY PRESS
Cambridge, New York, Melbourne, Madrid, Cape Town, Singapore, São Paulo
Cambridge University Press has no responsibility for the persistence or accuracy of urls
for external or third-party internet websites referred to in this publication, and does not
guarantee that any content on such websites is, or will remain, accurate or appropriate.
P1: KAE Gutter margin: 7/8 Top margin: 3/8
CUUS154-FM CUUS154-Edmonds 978 0 521 84931 9 April 2, 2008 17:52
v
P1: KAE Gutter margin: 7/8 Top margin: 3/8
CUUS154-FM CUUS154-Edmonds 978 0 521 84931 9 April 2, 2008 17:52
Problem Solving
Out of the Box Leaping
Deep Thinking
Creative Abstracting
Logical Deducing
with Friends Working
Fun Having
Fumbling and Bumbling
Bravely Persevering
Joyfully Succeeding
vi
P1: KAE Gutter margin: 7/8 Top margin: 3/8
CUUS154-FM CUUS154-Edmonds 978 0 521 84931 9 April 2, 2008 17:52
CONTENTS vii
Preface page xi
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Contents
Contents
Contents
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Index 439
P1: KAE Gutter margin: 7/8 Top margin: 3/8
CUUS154-FM CUUS154-Edmonds 978 0 521 84931 9 April 2, 2008 17:52
PREFACE xi
Meta-Algorithms: Students must learn so many algorithms that they are sometimes
overwhelmed. In order to facilitate their understanding, most textbooks cover the
standard themes of iterative algorithms, recursion, greedy algorithms, and dynamic
programming. Generally, however, when it comes to presenting the algorithms them-
selves and their proofs of correctness, the concepts are hidden within optimized
code and slick proofs. One goal of this book is to present a uniform and clean way
of thinking about algorithms. We do this by focusing on the structure and proof of
correctness of iterative and recursive meta-algorithms, and within these the greedy
and dynamic programming meta-algorithms. By learning these and their proofs of
correctness, most actual algorithms can be easily understood. The challenge is that
thinking about meta-algorithms requires a great deal of abstract thinking.
Preface
Way of Thinking: People who develop algorithms have various ways of thinking and
intuition that tend not to get taught. The assumption, I suppose, is that these cannot
be taught but must be figured out on one’s own. This text attempts to teach students
to think like a designer of algorithms.
xii Not a Reference Book: My intention is not to teach a specific selection of algorithms
for specific purposes. Hence, the book is not organized according to the application
of the algorithms, but according to the techniques and abstractions used to develop
them.
Big Picture vs. Small Steps: For each topic, I attempt both to give the big picture and
to break it down into easily understood steps.
Point Form: The text is organized into blocks, each containing a title and a single
thought. Hopefully, this will make the text easier to lecture and study from.
Prerequisites: The text assumes that the students have completed a first-year
programming course and have a general mathematical maturity. The Appendix
(Part Four) covers much of the mathematics that will be needed.
Read Ahead: The student is expected to read the material before the lecture. This will
facilitate productive discussion during class.
Explaining: To be able to prove yourself on a test or on the job, you need to be able
to explain the material well. In addition, explaining it to someone else is the best way
to learn it yourself. Hence, I highly recommend spending a lot of time explaining
P1: KAE Gutter margin: 7/8 Top margin: 3/8
CUUS154-FM CUUS154-Edmonds 978 0 521 84931 9 April 2, 2008 17:52
Preface
the material over and over again out loud to yourself, to each other, and to your
stuffed bear.
Acknowledgments
I would like to thank Andy Mirzaian, Franck van Breugel, James Elder, Suprakash
Datta, Eric Ruppert, Russell Impagliazzo, Toniann Pitassi, and Kirk Pruhs, with whom
I co-taught and co-researched algorithms for many years. I would like to thank Jen-
nifer Wolfe and Lauren Cowles for their fantastic editing jobs. All of these people were
a tremendous support for this work.
Discovering Diverse Content Through
Random Scribd Documents
distance. We now made sail for the island; and, presently after,
discovered a small inlet which had the appearance of being a good
harbour. In order to be better informed, I sent away two armed
boats, under the command of Lieutenant Cooper, to sound it; and, in
the mean while, we stood on and off with the ship, to be ready to
follow, or give them any assistance they might want. On the east
point of the entrance, we observed a number of people, and several
houses and canoes; and when our boats entered the harbour they
launched some, and followed them, but came not near. It was not
long before Mr. Cooper made the signal for anchorage; and we stood
in with the ship. The wind being at west, and our course S. S. W., we
borrowed close to the west point, and passed over some sunken
rocks, which might have been avoided by keeping a little more to the
east, or about one-third channel over. The wind left us as soon as
we were within the entrance, and obliged us to drop an anchor in
four fathoms water. After this, the boats were sent again to sound;
and, in the mean time, the launch was hoisted out, in order to carry
out anchors to warp in by, as soon as we should be acquainted with
the channel.
While we were thus employed, many of the natives got together in
parties, on several parts of the shore, all armed with bows, spears,
&c. Some swam off to us, others came in canoes. At first they were
shy, and kept at the distance of a stone’s throw; they grew
insensibly bolder; and, at last, came under our stern, and made
some exchanges. The people in one of the first canoes, after coming
as near as they durst, threw towards us some cocoa-nuts. I went
into a boat and picked them up, giving them in return some cloth
and other articles. This induced others to come under the stern, and
alongside, where their behaviour was insolent and daring. They
wanted to carry off every thing within their reach; they got hold of
the fly of the ensign, and would have torn it from the staff; others
attempted to knock the rings off the rudder; but the greatest trouble
they gave us was to look after the buoys of our anchors, which were
no sooner thrown out of the boats, or let go from the ship, than they
got hold of them. A few musquets fired in the air had no effect; but
a four-pounder frightened them so much, that they quitted their
canoes that instant, and took to the water. But as soon as they
found themselves unhurt, they got again into their canoes; gave us
some halloos; flourished their weapons; and returned once more to
the buoys. This put us to the expence of a few musketoon shot,
which had the desired effect. Although none were hurt, they were
afterwards afraid to come near the buoys; very soon all retired on
shore; and we were permitted to sit down to dinner undisturbed.
During these transactions, a friendly old man in a small canoe
made several trips between us and the shore, bringing off each time
a few cocoa-nuts, or a yam, and taking in exchange whatever we
gave him. Another was on the gangway when the great gun was
fired, but I could not prevail on him to stay there long. Towards the
evening, after the ship was moored, I landed at the head of the
harbour, in the S. E. corner, with a strong party of men, without any
opposition being made by a great number of the natives who were
assembled in two parties, the one on our right, the other on our left,
armed with clubs, darts, spears, slings, and stones, bows and
arrows, &c. After distributing to the old people, (for we could
distinguish no chief,) and some others, presents of cloth, medals,
&c., I ordered two casks to be filled with water out of a pond about
twenty paces behind the landing-place; giving the natives to
understand, that this was one of the articles we wanted. Besides
water, we got from them a few cocoa-nuts, which seemed to be in
plenty on the trees; but they could not be prevailed upon to part
with any of their weapons. These they held in constant readiness,
and in the proper attitudes of offence and defence; so that little was
wanting to make them attack us; at least we thought so, by their
pressing so much upon us, and in spite of our endeavours to keep
them off. Our early re-embarking probably disconcerted their
scheme; and after that, they all retired. The friendly old man before
mentioned, was in one of these parties; and we judged, from his
conduct, that his temper was pacific.
CHAP. V.
D uring the night the wind had veered round to S. E. As this was
favourable for getting out of the harbour, at four o’clock in the
morning of the 20th, we began to unmoor, and at eight, having
weighed our last anchor, put to sea. As soon as we were clear of the
land, I brought to, waiting for the launch which was left behind to
take up a kedge-anchor and hawser we had out, to cast by. About
day-break a noise was heard in the woods, nearly abreast of us, on
the east side of the harbour, not unlike singing of psalms. I was told
that the like had been heard at the same time every morning, but it
never came to my knowledge till now, when it was too late to learn
the occasion of it. Some were of opinion, that at the east point of
the harbour (where we observed, in coming in, some houses, boats,
&c.) was something sacred to religion, because some of our people
had attempted to go to this point, and were prevented by the
natives. I thought, and do still think, it was only owing to a desire
they showed, on every occasion, of fixing bounds to our excursions.
So far as we had once been, we might go again; but not farther with
their consent. But by encroaching a little every time, our country
expeditions were insensibly extended without giving the least
umbrage. Besides, these morning ceremonies, whether religious or
not, were not performed down at that point, but in a part where
some of our people had been daily.
I cannot say what might be the true cause of these people
showing such dislike to our going up into their country. It might be
owing to a naturally jealous disposition, or perhaps to their being
accustomed to hostile visits from their neighbours, or quarrels
among themselves. Circumstances seemed to show that such must
frequently happen; for we observed them very expert in arms, and
well accustomed to them; seldom or never travelling without them.
It is possible all this might be on our account; but I hardly think it.
We never gave them the least molestation, nor did we touch any
part of their property, not even the wood and water, without first
having obtained their consent. The very cocoa-nuts, hanging over
the heads of the workmen, were as safe as those in the middle of
the island. It happened, rather fortunately, that there were so many
cocoa-nut trees near the skirts of the harbour, which seemed not to
be private property; so that we could generally prevail on the natives
to bring us some of these nuts, when nothing would induce them to
bring any out of the country.
We were not wholly without refreshments; for besides the fish,
which our seine now and then provided us with, we procured daily
some fruits or roots from the natives, though but little in proportion
to what we could consume. The reason why we got no more might
be our having nothing to give them in exchange, which they thought
valuable. They had not the least knowledge of iron; consequently,
nails and iron tools, beads, &c. which had so great a run at the more
eastern isles, were of no consideration here; and cloth can be of no
use to people who go naked.
The produce of this island is bread-fruit, plantains, cocoa-nuts, a
fruit like a nectarine, yams, terra, a sort of potatoe, sugar-cane, wild
figs, a fruit like an orange, which is not eatable, and some other fruit
and nuts whose names I have not. Nor have I any doubt that the
nutmeg before mentioned was the produce of this island. The bread-
fruit, cocoa-nuts, and plantains, are neither so plentiful nor so good
as at Otaheite; on the other hand, sugar-canes and yams are not
only in greater plenty, but of superior quality, and much larger. We
got one of the latter which weighed fifty-six pounds, every ounce of
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
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