Data Structures and Algorithm Analysis in JavaTM 3rd edition by Mark Weiss 9780133465013 0133465012 - Get instant access to the full ebook with detailed content
Data Structures and Algorithm Analysis in JavaTM 3rd edition by Mark Weiss 9780133465013 0133465012 - Get instant access to the full ebook with detailed content
_____ Follow the link below to get your download now _____
https://ebookball.com/product/data-structures-and-algorithm-
analysis-in-javatm-3rd-edition-by-mark-
weiss-9780133465013-0133465012-18710/
https://ebookball.com/product/data-structures-and-algorithm-analysis-
in-c-4th-edition-by-mark-weiss-013284737x-9780132847377-15292/
https://ebookball.com/product/data-structures-and-algorithm-analysis-
in-c-3rd-edition-by-clifford-shaffer-
isbn-048648582x-978-0486485829-16486/
https://ebookball.com/product/a-practical-introduction-to-data-
structures-and-algorithm-analysis-3rd-edition-by-clifford-
shaffer-15310/
Data Structures And Problem Solving Using Java 4th Edition
by Mark Weiss 0321541405 9780321541406
https://ebookball.com/product/data-structures-and-problem-solving-
using-java-4th-edition-by-mark-weiss-0321541405-9780321541406-17186/
https://ebookball.com/product/data-structures-and-problem-solving-
using-java-4th-edition-by-mark-allen-weiss-
isbn-0321541405-978-0321541406-16342/
https://ebookball.com/product/c-plus-data-structures-3rd-edition-by-
nell-dale-isbn-0763704810-9780763704810-12430/
Data
Structures
and Algorithm
Analysis in
JavaTM
TM
This page intentionally left blank
Third Edition
Data
Structures
and Algorithm
Analysis in
Java
TM
Mark A l l e n Weiss
Florida International University
PEARSON
Boston Columbus Indianapolis New York San Francisco Upper Saddle River
Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto
Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo
Editorial Director: Marcia Horton Project Manager: Pat Brown
Editor-in-Chief: Michael Hirsch Manufacturing Buyer: Pat Brown
Editorial Assistant: Emma Snider Art Director: Jayne Conte
Director of Marketing: Patrice Jones Cover Designer: Bruce Kenselaar
Marketing Manager: Yezan Alayan Cover Photo: c De-Kay Dreamstime.com
Marketing Coordinator: Kathryn Ferranti Media Editor: Daniel Sandin
Director of Production: Vince O’Brien Full-Service Project Management: Integra
Managing Editor: Jeff Holcomb Composition: Integra
Production Project Manager: Kayla Printer/Binder: Courier Westford
Smith-Tarbox Cover Printer: Lehigh-Phoenix Color/Hagerstown
Text Font: Berkeley-Book
Copyright c 2012, 2007, 1999 Pearson Education, Inc., publishing as Addison-Wesley. All rights reserved.
Printed in the United States of America. This publication is protected by Copyright, and permission should
be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or trans-
mission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain
permission(s) to use material from this work, please submit a written request to Pearson Education, Inc.,
Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your
request to 201-236-3290.
Many of the designations by manufacturers and sellers to distinguish their products are claimed as trade-
marks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the
designations have been printed in initial caps or all caps.
15 14 13 12 11—CRW—10 9 8 7 6 5 4 3 2 1
Preface xvii
Chapter 1 Introduction 1
1.1 What’s the Book About? 1
1.2 Mathematics Review 2
1.2.1 Exponents 3
1.2.2 Logarithms 3
1.2.3 Series 4
1.2.4 Modular Arithmetic 5
1.2.5 The P Word 6
1.3 A Brief Introduction to Recursion 8
1.4 Implementing Generic Components Pre-Java 5 12
1.4.1 Using Object for Genericity 13
1.4.2 Wrappers for Primitive Types 14
1.4.3 Using Interface Types for Genericity 14
1.4.4 Compatibility of Array Types 16
1.5 Implementing Generic Components Using Java 5 Generics 16
1.5.1 Simple Generic Classes and Interfaces 17
1.5.2 Autoboxing/Unboxing 18
1.5.3 The Diamond Operator 18
1.5.4 Wildcards with Bounds 19
1.5.5 Generic Static Methods 20
1.5.6 Type Bounds 21
1.5.7 Type Erasure 22
1.5.8 Restrictions on Generics 23
vii
viii Contents
Author: F. Volkhovskii
Language: English
BY
FELIX VOLKHOVSKY
ILLUSTRATED BY MALISCHEFF
LONDON
T. FISHER UNWIN
1892
SECOND EDITION
CONTENTS
PAGE
I. A China Cup 3
II. How Scarlet-Comb the Cock defended the Right 37
III. The Tiny Screw 65
IV. The Dream 85
V. Browny 115
VI. The Old Sword's Mistake 125
VII. 'My Own' 141
VIII. The Tale about how all these Tales came to Light 167
A CHINA CUP
waggon drove to the great pit dug in the clay—not
common clay, but such as china vessels are made of. A
man with an iron spade jumped from the waggon; he
entered the pit and began to dig the clay. After the first
stroke of the spade a little lump fell out of the native
ground, and with a bitter, plaintive murmur rolled down. Nobody
heard the murmur; it seemed to the workman that the Lump in
rolling down made a slight noise, whereas it was groaning: it was
hard to be torn away from mother earth. 'All is over,' it whispered;
'oh, how hard it is to live in the world!'
The workman took it up on his spade with the other clay, and threw
it into the waggon. 'Oh!' groaned the bit of clay from pain, as it fell
on the bottom of the waggon; 'not only was I torn away from my
mother, but thrown far away from her. Alas! is there any one more
unhappy in this world than I? I should like to die!'
But the Lump did not die. The workman had soon filled up his
waggon, jumped in himself, and drove away, carrying it to the china
factory. It was pretty well while they were going along an even
place, but when they went down a steep mountain-side, the horse
ran fast, and our Lump was jolted, thrown from side to side, and
knocked against the waggon. Nor did all its torments end then. As
soon as it was brought to the china factory, it was thrown with other
clay into a large tub with water in it, and it felt with horror how it
began gradually to get soft, and to be transformed into a sort of soft
mud. It had no time to recover, as it was taken out with a great ladle
and poured somewhere—it was into the funnel of the great
millstones. The driver shouted, the horses went on, pulled one end
of a bar, which was fastened by the other end to a big axle standing
erect in the middle of the great millstones; the bar again turned the
axle to which the upper millstone was fastened, and the millstones
began to grind the water-softened clay, crushing its smallest
particles. Our Lump no longer existed, but all its little particles which
before formed it were now like clay-jelly, and kept close together.
Ah, how they suffered! The awful millstone pressed upon them with
its whole weight—squeezed, flattened, ground them. They
shrivelled, groaned, cried from pain and said: 'Oh-o-o! what a
torture! it is all over with us!'
But that was not all. After the grinding the clay-jelly was poured by
means of gutters into the empty wooden tub to settle. There the
hard particles, heavier than water, sank.... On the bottom was the
sand, next the reddish clay, mixed with iron-rust, then the coarser
parts of the white clay, and finally its lightest particles, quite free
from all other mixture. All the particles of our Lump happened to be
of the same weight and to be nicely ground; they sank together and
formed again the same Lump, only soft, delicate, and free from all
unnecessary admixture. It was very nice, of course, but the little
Lump was so tired from all it suffered, so exhausted, that it did not
wish to live in the world. 'I would rather death would come!' it said.
Death, however, did not come. A workman came instead, poured off
the water which was on the surface of the clay, cut the clay to the
bottom, separated it into layers, and assorted them, so that the
upper, more delicate layer was for the best china vessels, and the
lower for the coarser plates. As our Lump was in the upper layer, it
was taken to a workman who made the finest vessels.
The workman took our Lump, put it into the middle of a round table
which turned on its centre, made this table spin round with his feet,
and at the same time pressed the clay here and there till he had
made a coarse cup without a handle. The workman then, with an
instrument like a knife, began to turn the cup, till it became a fine,
fine one. He then handed it to his neighbour, who put a nice little
handle to it. 'Well,' thought the Lump, transformed now into a cup,
'it is not so bad. I suffered indeed, but what a beauty I am now!' ...
and the Cup looked self-contentedly around. She did not rejoice
long. She was soon put with others into one of the pots of particular
form called 'muffles,' and the muffles were put into a furnace, which
began to heat the Cup by scorching degrees to make it red hot. 'Oh,
how hot it is!' stammered the poor Cup, perspiring, crying, and
groaning at once. 'Oh, what a torture! Oh, how hard it is to live in
the world! I should like to die!'
Still, she did not die. She was taken from the furnace, watered with
a certain mixture, burnt once more. A charming bouquet and
garland were then painted on her, and the Cup did not recognise
herself. 'Ah, how happy I am!' said she to herself; 'it was worth while
to suffer all that I suffered. I am the most beautiful here, and there
is and will be no one happier.'
Very soon the Cup went from the factory to the shop. She was
delighted to see the fine hall with large windows and nice glass
cases. She enjoyed the society of china cups, teapots, plates, and all
sorts of most beautiful things.
'Here,' thought she, 'they can appreciate my beauty!' and she
immediately addressed her neighbour, a big, round teapot: 'Please,
sir, have you been long here?'
'Yes,' answered the teapot gruffly, knocking with his coarse lid.
'And do you think there was ever before a cup with such fine
ornament and delicate painting as I have?'
'Ho-ho-ho-ha-ha!' ... laughed the big teapot. 'Just listen!' shouted he
to his companions, as big and coarse as himself; 'this damsel is
asking whether there is in the world a beauty like her?... O-ho-ho-
ho!'
'Ha-ha-ha-ha-ha!' burst all the big teapots in laughter, holding their
sides with their handles.
Our Cup was offended, and ashamed to tears.
'What are you laughing at?' whispered she in confusion.
'And how can we help laughing?' exclaimed her neighbour; 'you
think too much of yourself; and what are you good for? To spend all
your life on some nice shelf; you need cheapness and solidity to be
of some use. And as for your ornament, look to your right, on the
third shelf; there are more elegant ones there than you!'
The Cup looked to the right, and would have grown green from envy
if she could have changed colour. There were standing fine cups on
small feet; such delicate, fine cups, like white, pale, and pink rose
petals! ... the beautiful bouquets, the prettiest heads, the finest gold
lace, with black and green ornamentation, were painted upon them.
These cups were also proud of their beauty, and as they were more
beautiful than their new companion, they looked at her with
contempt and haughtiness.
In the china factory the Cup thought herself the most beautiful in
the world, and was quite happy; and now she was forced not only to
acknowledge that there were more beautiful ones, but to listen to
the mocking words and endure the most offensive looks. Envy,
vexation, shame, tormented her, and she would fain run away
somewhere, yet she could not move from the spot. This helplessness
added still to her pain and anger. She would like to have sunk into
the earth. 'Ah,' thought she, 'why did I not die before! Why does
death not come now!'
Death did not come, however. The shop door opened, a fine lady,
with a richly-dressed young girl of about ten years of age, came in.
'We want a nice cup, not too expensive,' said the lady to the
shopman at the counter.
The shopman took our Cup and some others from the shelf and put
them on the counter. Oh, what our Cup felt at that moment! She
was displayed with half a dozen of her companions, every one of
whom thought herself more beautiful than the others, and was
proud of it. Suppose these elegant purchasers should give the
preference not to her, but to one of her conceited companions? She
felt as if on burning coals. The little girl stretched her hand to one of
our Cup's neighbours, and the Cup trembled with anxiety. But the
little purchaser only touched the rival of our Cup and finally took the
latter. 'This one, mamma,' said the child, and the mother bought her.
Oh, with what a pride shone now this plaything, and how haughtily
she looked at her companions! Her beauty is now openly
acknowledged; she is preferred to others! She was bright with
happiness, and slightly trembled when the shopman took her from
the counter to wrap her in paper.
'Ah, how happy I am!' said the Cup in the evening, when fragrant
tea was poured in, and all who were sitting at the tea-table admired
her; 'of course there is and will be nobody happier than I.'
Just at this moment the pretty little girl who had chosen her at the
shop came running in from the garden. She was very thirsty. She
seized the Cup and took a sip at once, notwithstanding that they
cried to her that the tea was too hot. The Cup certainly was not to
blame that the girl from her own carelessness had scalded her
mouth, and the girl treated her unjustly. 'Oh, you nasty Cup!' cried
she, and threw her to the floor.
Crash! ... and the pieces of the poor innocent Cup tinkled plaintively,
and drops of tea, like big tears, trickled on to the floor from her. The
footman came, gathered the pieces of the broken Cup and threw
them away into the backyard on the rubbish heap. There she was
with the bits of old leather, broken glass, rusty pieces of tin, and a
pair of decaying cucumbers. She shivered from contact with the dirt,
which she had never experienced since she was a nice cup, and she
felt sick from the unpleasant odour. 'Oh, how unhappy I am!' said
the broken Cup. 'All is over. I have nothing to expect from life. I have
only to die!'
The Cup did not lie long in the rubbish heap. Early, early the next
morning, when all were yet asleep in the house, there came into the
backyard a poor, wrinkled, dirty, ragged, old woman. She had on her
back a bag, and a big stick with a hook on its end in her hand. She
was a rag-gatherer. She dug into the heaps with her hook, picked
out of them the bones, rags, paper, nails, pieces of glass, and such
things thrown away as seemed to the poor woman of some use.
After having filled up the bag, the rag-gatherer went home, sorted
its contents, and then took the bones to the shoeblacking maker,
rags and paper to the pasteboard maker, the iron to the dealer in old
iron, and the glass to the glass factory. All these places were far
from each other and from her lodging, and the poor woman was
exceedingly tired in going from one place to another. She gained
thus a few copecks,[1] without which neither she nor her sick
granddaughter would have had anything to eat. On the following
morning the old woman went again to dig among the heaps.
Coming near the rubbish heap where the broken Cup was lying, the
woman began to work with her hook, seeking with her old, tearful,
short-sighted eyes something worth having. She had already dug up
all that she wanted, when her hook struck against something hard;
the old woman knew by this sound that there was something like
glass in the heap. She stooped down and took up a fragment of the
Cup with a nice nosegay on it.
'What fine flowers!' whispered she; 'I will take it home for Mary—a
nice plaything for her—I must take it.'
The good old woman smiled, as she thought of her beloved
granddaughter, called Mary. She began to search again among the
rubbish, and found that there were many fine pieces, and those not
too small. 'Oh, the pieces are all here,' said she; 'it is possible
perhaps to cement them together.' And taking all the bits she put
them by themselves into the pocket of her worn-out petticoat.
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.
ebookball.com