Data Structures and Other Objects Using C++ 2nd edition by Michael Main ISBN 8129705826 978-8129705822 download
Data Structures and Other Objects Using C++ 2nd edition by Michael Main ISBN 8129705826 978-8129705822 download
https://ebookball.com/product/data-structures-and-other-objects-
using-c-2nd-edition-by-michael-main-
isbn-8129705826-978-8129705822-16344/
https://ebookball.com/product/data-structures-and-other-objects-
using-c-4th-edition-by-michael-main-walter-
savitch-0132129485-9780132129480-17178/
https://ebookball.com/product/data-structures-using-c-2nd-edition-by-
malik-0324782012-978-0324782011-17222/
https://ebookball.com/product/data-structures-and-problem-solving-
using-c-2nd-edition-by-malik-isbn-0324782012-978-0324782011-16350/
https://ebookball.com/product/principles-of-data-structures-using-c-
and-c-1st-edition-by-vinu-das-isbn-8122418589-9788122418583-15766/
https://ebookball.com/product/problem-solving-in-data-structures-and-
algorithms-using-c-1st-edition-by-hemant-jain-
isbn-9352655915-9789352655915-15768/
https://ebookball.com/product/problem-solving-in-data-structures-and-
algorithms-using-c-1st-edition-by-hemant-jain-
isbn-1540407306-9781540407306-15866/
DATA
STRUCTURES
&
OTHER
OBJECTS
Using C++ 4TH
EDITION
MICHAEL MAIN
Department of Computer Science
University of Colorado at Boulder
WALTER SAVITCH
Department of Computer Science
and Engineering
University of California, San Diego
Addison-Wesley
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
ii Preface
Editor-in-Chief: Michael Hirsch Marketing Manager: Erin Davis
Editorial Assistant: Stephanie Sellinger Marketing Coordinator: Kathryn Ferranti
Managing Editor: Jeffrey Holcomb Art Director: Linda Knowles
Production Project Manager: Heather McNally Cover Designer: Elena Sidorova
Copy Editor: Sada Preisch Cover Artwork: © 2010 Stocksearch / Alamy
Proofreader: Genevieve d’Entremont Senior Manufacturing Buyer: Carol Melville
Access the latest information about all Pearson Addison-Wesley Computer Science titles from our World
Wide Web site: http://www.pearsonhighered.com/cs
The programs and applications presented in this book have been included for their instructional value. They
have been tested with care, but are not guaranteed for any particular purpose. The publisher does not offer any
warranties or representations, nor does it accept any liabilities with respect to the programs or applications.
Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook
appear on appropriate page within text.
UNIX® is a registered trademark in the United States and other countries, licensed exclusively through X-Open
Company, Ltd. Pez® is a registered trademark of Pez Candy, Inc.
Copyright © 2011, 2005, 2001, 1997 Pearson Education, Inc., publishing as Addison-Wesley, 501 Boylston
Street, Suite 900, Boston MA 02116. All rights reserved. Manufactured 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 transmission 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, , 501 Boylston Street,
Suite 900, Boston MA 02116.
Many of the designations by manufacturers and seller to distinguish their products are claimed as trademarks.
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.
QA76.73.C153M25 2010
005.13’3—dc22
2009049328
CIP
1 2 3 4 5 6 7 8 9 10--CRS--14 13 12 11 10
Preface
menting these (or similar) classes. With this in mind, the primary changes that
you’ll find for this edition are:
• A new Section 2.6 that gives an early introduction to the Standard Tem-
plate Library using the pair class. We have been able to introduce students
to the STL here even before they have a full understanding of templates.
• An earlier introduction of the multiset class and STL iterators in Section
3.4. This is a good location for the material because the students have just
seen how to implement their first collection class (the bag), which is
based on the multiset.
• We continue to introduce the STL string class in Section 4.5, where it’s
appropriate for the students to implement their own string class with a
dynamic array.
• A new Section 5.6 that compares three similar STL classes: the vector, the
list, and the deque. At this point, the students have enough knowledge to
understand typical vector and list implementations.
• A first introduction to the STL algorithms appears in Section 6.3, and this
is now expanded on in Sections 11.2 (the heap algorithms) and 13.4
(expanded coverage of sorting and binary search in the STL).
• A new Section 8.4 provides typical implementation details for the STL
deque class using an interesting combination of dynamic arrays and point-
ers.
• A discussion of hash tables in the proposed TR1 expansions for the STL
is now given in Section 12.6.
Most chapters also include new programming projects, and you may also keep
an eye on our project web site, www.cs.colorado.edu/~main/dsoc.html, for new
projects as we develop them.
Step 1: Understand the data type abstractly. At this level, a student gains an
understanding of the data type and its operations at the level of concepts and
pictures. For example, a student can visualize a stack and its operations of push-
ing and popping elements. Simple applications are understood and can be car-
ried out by hand, such as using a stack to reverse the order of letters in a word.
Step 2: Write a specification of the data type as a C++ class. In this step,
the student sees and learns how to write a specification for a C++ class that can
Preface v
implement the data type. The specification includes prototypes for the construc-
tors, public member functions, and sometimes other public features (such as an
underlying constant that determines the maximum size of a stack). The prototype
of each member function is presented along with a precondition/postcondition
contract that completely specifies the behavior of the function. At this level, it’s
important for the students to realize that the specification is not tied to any par-
ticular choice of implementation techniques. In fact, this same specification may
be used several times for several different implementations of the same data type.
Step 3: Use the data type. With the specification in place, students can write
small applications or demonstration programs to show the data type in use.
These applications are based solely on the data type’s specification, as we still
have not tied down the implementation.
understood. With this in mind, some instructors may wish to cover Chapter 14
earlier, just before stacks and queues.
Another alternative is to identify students who already know the basics of
classes. These students can carry out an inheritance project (such as the ecosys-
tem of Section 14.2 or the game engine in Section 14.3) while the rest of the stu-
dents first learn about classes.
Iterators. Iterators are another important part of the proposed Standard Tem-
plate Library, allowing a programmer to easily step through the items in a con-
tainer object (such as the elements of a set or bag). Such iterators may be
internal (implemented with member functions of the container class) or external
(implemented by a separate class that is a friend of the container class). We
introduce internal iterators with one of the first container classes (a sequential
list in Section 3.2). An internal iterator is added to the bag class when it is
needed in Chapter 6. At that point, the more complex external iterators also are
discussed, and students should be aware of the advantages of an external itera-
tor. Throughout the text, iterators provide a good opportunity for programming
projects, such as implementing an external bag iterator (Chapter 6) or using a
stack to implement an internal iterator of a binary search tree (Chapter 10).
In a course that has time for advanced tree projects (Chapter 11), we analyze
the recursive tree algorithms, explaining the importance of keeping the trees
balanced—both to improve worst-case performance, and to avoid potential run-
time stack overflow.
Advanced Projects
The text offers good opportunities for optional projects that can be undertaken
by a more advanced class or by students with a stronger background in a large
class. Particular advanced projects include the following:
• A polynomial class using dynamic memory (Section 4.6).
• An introduction to Standard Library iterators, culminating in an imple-
mentation of an iterator for the student’s bag class (Sections 6.3 through
6.5).
• An iterator for the binary search tree (Programming Projects in Chapter
10).
• A priority queue, implemented with a linked list (Chapter 8 projects), or
implemented using a heap (Section 11.1).
• A set class, implemented with B-trees (Section 11.3). We have made a
particular effort on this project to provide information that is sufficient for
students to implement the class without need of another text. In our
courses, we have successfully directed advanced students to do this
project as independent work.
• An inheritance project, such as the ecosystem of Section 14.2.
• An inheritance project using an abstract base class such as the game base
class in Section 14.3 (which allows easy implementation of two-player
games such as Othello or Connect Four).
• A graph class and associated graph algorithms from Chapter 15. This is
another case where advanced students may do work on their own.
Preface ix
Typical course. Start with Chapters 1–10, skipping parts of Chapter 2 if the
students have a prior background in C++ classes. Most chapters can be covered
in a week, but you may want more time for Chapter 5 (linked lists), Chapter 6
(templates), Chapter 9 (recursion), or Chapter 10 (trees). Typically, we cover the
material in 13 weeks, including time for exams and extra time for linked lists
and trees. Remaining weeks can be spent on a tree project from Chapter 11, or
on binary search (Section 12.1) and sorting (Chapter 13).
extra weeks at the end of the term, so that students may spend more time on
searching, sorting, and the advanced topics (shaded on page xi.)
We also have taught the course with further acceleration by spending no lec-
ture time on stacks and queues (but assigning those chapters as reading).
Early recursion / early sorting. One to three weeks may be spent at the start
of class on recursive thinking. The first reading will then be Chapters 1 and 9,
perhaps supplemented by additional recursive projects.
If recursion is covered early, you may also proceed to cover binary search
(Section 12.1) and most of the sorting algorithms (Chapter 13) before introduc-
ing C++ classes.
Chapter Dependencies
At the start of the course, students should be comfortable writing functions and using
arrays in C++ or C. Those who have used only C should read Appendix F and pay
particular attention to the discussion of reference parameters in Section 2.4.
Chapter 1
Introduction
Section 14.3
Virtual Methods Section 11.4
Detailed Tree Analysis
The shaded boxes provide
good opportunities for
advanced work.
xii Preface
Acknowledgments
We started this book while Walter was visiting Michael at the Computer Science
Department of the University of Colorado in Boulder. The work was completed
after Walter moved back to the Department of Engineering and Computer Sci-
ence at the University of California, San Diego. We are grateful to these institu-
tions for providing facilities, wonderful students, and interaction with congenial
colleagues.
Our students have been particularly helpful—nearly 5000 of our students
worked through the material, making suggestions, showing us how they learned.
We thank the reviewers and instructors who used the material in their data struc-
tures courses and provided feedback: Zachary Bergen, Cathy Bishop, Martin
Burtscher, Gina Cherry, Courtney Comstock, Stephen Davies, Robert Frohardt,
John Gillett, Mike Hendricks, Ralph Hollingsworth, Yingdan Huang, Patrick
Lynn, Ron McCarty, Shivakant Mishra, Evi Nemeth, Rick Osborne, Rachelle
Reese, and Nicholas Tran. The book was also extensively reviewed by Wolfgang
W. Bein, Bill Hankley, Michael Milligan, Paul Nagin, Jeff Parker, Andrew L.
Wright, John R. Rose, and Evan Zweifel. We thank these colleagues for their
excellent critique and their encouragement.
Thank you to Lesley McDowell and Chris Schenk, who are pleasant and
enthusiastic every day in the computer science department at the University of
Colorado. Our thanks also go to the editors and staff at Addison-Wesley. Heather
McNally’s work has encouraged us and provided us with smooth interaction on
a daily basis and eased every step of the production. Karin Dejamaer and Jessica
Hector provided friendly encouragement in Boulder, and we offer our thanks to
them. We welcome and appreciate Michael Hirsch in the role of editor, where he
has shown amazing energy, enthusiasm, and encouragement. Finally, our origi-
nal editor, Susan Hartman, has provided continual support, encouragement, and
direction—the book wouldn’t be here without you!
In addition to the work and support from those who put the book together, we
thank those who offered us daily interest and encouragement. Our deepest thanks
go to Holly Arnold, Vanessa Crittenden, Meredith Boyles, Suzanne Church, Erika
Civils, Lynne Conklin, Andrzej Ehrenfeucht, Paul Eisenbrey, Skip Ellis, John
Kennedy, Rick Lowell, George Main, Mickey Main, Jesse Nuzzi, Ben Powell,
Marga Powell, Megan Powell, Grzegorz Rozenberg, Hannah, Timothy, and
Janet.
Contents
2.2 Constructors 45
The Throttle’s Constructor 46
What Happens If You Write a Class with No Constructors? 49
Programming Tip: Always Provide Constructors 49
Revising the Throttle’s Member Functions 49
Inline Member Functions 49
Programming Tip: When to Use an Inline Member Function 50
Self-Test Exercises for Section 2.2 51
2.3 Using a Namespace, Header File, and Implementation File 51
Creating a Namespace 51
The Header File 52
Describing the Value Semantics of a Class Within the Header File 56
Programming Tip: Document the Value Semantics 57
The Implementation File 57
Using the Items in a Namespace 59
Pitfall: Never Put a Using Statement Actually in a Header File 60
Self-Test Exercises for Section 2.3 62
2.4 Classes and Parameters 63
Programming Example: The Point Class 63
Default Arguments 65
Programming Tip: A Default Constructor Can Be Provided by Using Default
Arguments 66
Parameters 67
Pitfall: Using a Wrong Argument Type for a Reference Parameter 70
Clarifying the Const Keyword
Part 3: Const Reference Parameters 72
Programming Tip: Use const Consistently 73
When the Type of a Function’s Return Value Is a Class 73
Self-Test Exercises for Section 2.4 74
2.5 Operator Overloading 74
Overloading Binary Comparison Operators 75
Overloading Binary Arithmetic Operators 76
Overloading Output and Input Operators 77
Friend Functions 80
Programming Tip: When to Use a Friend Function 81
The Point Class—Putting Things Together 82
Summary of Operator Overloading 85
Self-Test Exercises for Section 2.5 85
2.6 The Standard Template Libary and the Pair Class 86
Chapter Summary 87
Solutions to Self-Test Exercises 88
Programming Projects 90
Contents xvii
2
TWO FACES
Feeling the need of fresh air and quiet after the strain of the last half
hour, Ralph 124C 41+ climbed the few steps leading from the
laboratory to the roof and sat down on a bench beneath the
revolving aerial.
The hum of the great city came faintly from below. Aeroflyers dotted
the sky. From time to time, trans-oceanic or trans-continental air
liners passed with a low vibration, scarcely audible.
At times a great aircraft would come close—within 500 yards
perhaps—when the passengers would crane their necks to get a
good view of his "house," if such it could be called.
Indeed, his "house," which was a round tower, 650 feet high, and
thirty in diameter, built entirely of crystal glass-bricks and
steelonium, was one of the sights of New York. A grateful city,
recognizing his genius and his benefits to humanity, had erected the
great tower for him on a plot where, centuries ago, Union Square
had been.
The top of the tower was twice as great in circumference as the
main building, and in this upper part was located the research
laboratory, famous throughout the world. An electromagnetic tube
elevator ran down the tower on one side of the building, all the
rooms being circular in shape, except for the space taken up by the
elevator.
Ralph, sitting on the roof of his tower, was oblivious to all about him.
He was unable to dismiss from his mind the lovely face of the girl
whose life he had just been the means of saving. The soft tones of
her voice were in his ears. Heretofore engrossed in his work, his
scientific mind had been oblivious to women. They had played no
part in his life. Science had been his mistress, and a laboratory his
home.
And now, in one short half hour, for him the whole world had
become a new place. Two dark eyes, a bewitching pair of lips, a
voice that had stirred the very core of his being—
Ralph shook himself. It was not for him to think of these things, he
told himself. He was but a tool, a tool to advance science, to benefit
humanity. He belonged, not to himself, but to the Government—the
Government, who fed and clothed him, and whose doctors guarded
his health with every precaution. He had to pay the penalty of his +.
To be sure, he had everything. He had but to ask and his wish was
law—if it did not interfere with his work.
There were times he grew restive under the restraint, he longed to
smoke the tobacco forbidden him by watchful doctors, and to
indulge in those little vices which vary the monotony of existence for
the ordinary individual. There were times when he most ardently
wished that he were an ordinary individual.
He was not allowed to make dangerous tests personally, thereby
endangering a life invaluable to the Government. That institution
would supply him with some criminal under sentence of death who
would be compelled to undergo the test for him. If the criminal were
killed during the experiment, nothing was lost; if he did not perish,
he would be imprisoned for life.
Being a true scientist, Ralph wanted to make his own dangerous
experiments. Not to do this took away the very spice of life for him,
and on occasion he rebelled. He would call up the Planet Governor,
the ruler of 15 billion human beings, and demand that he be relieved
of his work.
"I can't stand it," he would protest. "This constraint which I am
forced to endure maddens me, I feel that I am being hampered."
The Governor, a wise man, and a kindly one, would often call upon
him in person, and for a long time they would discuss the question,
Ralph protesting, the Governor reasoning with him.
"I am nothing but a prisoner," Ralph stormed once.
"You are a great inventor," smiled the Governor, "and a tremendous
factor in the world's advancement. You are invaluable to humanity,
and—you are irreplaceable. You belong to the world—not to
yourself."
Many times in the past few years he recalled, had the two been over
the same ground, and many times had the diplomatic Governor
convinced the scientist that in sacrifice of self and devotion to the
world's future lay his great reward.
The voice of his manservant interrupted his reverie.
"Sir," he said, "your presence in the transmission-room would be
appreciated."
"What is it?" asked the scientist, impatient at the interruption.
"Sir, the people have heard all about the Switzerland incident of an
hour ago and desire to show their appreciation."
"Well, I suppose I must submit," the inventor rather wearily
responded, and both stepped over into the round steel car of the
electromagnetic elevator. The butler pressed one of the 28 ivory
buttons and the car shot downward, with neither noise nor friction.
There were no cables or guides, the car being held and propelled by
magnetism only. At the 22nd floor the car stopped, and Ralph
stepped into the transmission-room.
No sooner had he entered than the deafening applause of hundreds
of thousands of voices greeted him, and he was forced to put his
hands to his ears to muffle the sound.
Yet, the transmission-room was entirely empty.
Every inch of the wall, however, was covered with large-sized
Telephots and loud-speaking devices.
Centuries ago, when people tendered some one an ovation, they
would all assemble in some great square or large hall. The celebrity
would have to appear in person, else there would be no ovation—
truly a clumsy means. Then, too, in those years, people at a distance
could neither see nor hear what was going on throughout the world.
Ralph's ovation was the result of the enterprise of a news "paper"
which had issued extras about his exploit, and urged its readers to
be connected with him at 5 p.m.
Naturally everyone who could spare the time had called the
Teleservice Company and asked to be connected with the inventor's
trunk-line—and this was the result.
Ralph 124C 41 + stepped into the middle of the room and bowed to
the four points of the compass, in order that all might see him
perfectly. The noise was deafening, and as it rather grew in volume
than diminished he beseechingly held up his hands. In a few
seconds the applause ceased and some one cried—"Speech!"
Ralph spoke briefly, thanking his audience for their interest, and
touching but lightly upon his rescue of the young Swiss girl, begged
his hearers to remember that in no way had he risked his life and
therefore could scarcely be called a hero.
Vociferous cries of "No, no," told him that no one shared his humble
opinion of the achievement.
It was at this juncture that Ralph's attention was caught by two
persons in the audience. There were so many thousands of faces on
each plate that nearly every countenance was blurred, due to their
constant movement. (He himself, however, was clearly seen by
them, as each one had switched on their "reversers," making it
possible to see only the object at the end of the line.)
To Ralph, the shifting, clouded appearance of his audience was a
commonplace.
This was not the first time that he had been called upon to receive
the thanks of the multitude for some unusual service he had
rendered them, or some surprising scientific feat he had successfully
accomplished. While realizing that he must of necessity yield to
public adulation, it more or less bored him.
He was not particularly interested in the crowd, either collectively or
individually, and as there were so many faces crowded into each
faceplate he made no attempt to distinguish friends from strangers.
Yet there were two faces among the numerous Telephot faceplates
that Ralph in making his brief speech, found his eyes returning to
again and again. Each occupied the whole of a respective faceplate
and while dissimilar in appearance, nevertheless were markedly alike
in expression. It was as if they were studying this great scientist,
endeavoring to fix in their minds a permanent picture of him. Ralph
sensed no animosity in their steady almost hypnotic gaze and yet
they were curiously apart from the enthusiastic throng. He felt as
though he were, to both of them, under the microscope.
One of the faces was that of a man in his early thirties. It was a
handsome face, though, to the close observer, the eyes were set just
a trifle too near together, and the mouth betrayed cunning and had
a touch of viciousness.
The other was not a Terrestrial, but a visiting Martian. It was
impossible to mistake the distinctly Martian cast of countenance. The
great black horse eyes in the long, melancholy face, the elongated
slightly pointed ears were proof enough. Martians in New York were
not sufficiently rare to excite any particular comment. Many made
that city their permanent home, although the law on the planet
Earth, as well as on Mars, which forbade the intermarriage of
Martians and Terrestrials, kept them from flocking earthwards in any
great numbers.
In the applause that followed the conclusion of Ralph's words the
incident of the two pairs of scrutinizing eyes vanished from his
thoughts. But his sub-conscious self, that marvelous mechanism
which forgets nothing, had photographed them indelibly. With the
plaudits of the crowd still ringing he bowed and left the room.
He went, via the elevator, directly to his library, and asked for the
afternoon news.
His man handed him a tray on which lay a piece of material as large
as a postage stamp, as transparent and flexible as celluloid.
"What edition is this?" he asked.
"The 5 o'clock New York News,[1] sir."
Ralph took the "News" and placed it in a metal holder which was
part of the hinged door of a small box. He closed the door and
turned on a switch on the side of the box. Immediately there
appeared on the opposite white wall of the room, a twelve-column
page of the New York News and the scientist, leaning back in his
chair, proceeded to read.
The New York News was simply a microscopic reduction of a page,
which, when enlarged by a powerful lens, became plainly visible.
Moreover, each paper had eight "pages," in separate sheets, as was
the fashion centuries ago, but eight pages literally on top of each
other. The printing process was electrolytic, no ink whatsoever being
used in the manufacture of the "newspaper." This process was
invented in 1910 by an Englishman, and improved by the American
64L 52 in 2031, who made it possible to "print" in one operation
eight different subjects, one on top of another.
These eight impressions could be made visible only by subjecting the
"paper" to different colors, the color rays bringing out the different
prints. The seven colors of the rainbow were used, while white light
was employed to show reproduced photographs, etc., in their natural
colors. With this method it was possible to "print" a "newspaper,"
fully ten times as large in volume as any newspaper of the 21st
century, on a piece of film, the size of a postage-stamp.
Each paper published an edition every 30 minutes, and if one did not
possess a projector, one could read the "paper" by inserting the
News in a holder beneath a powerful lens which one carried in one's
pocket, folded when not in use. To read the eight different pages, a
revolving color screen was placed directly underneath the lens, to
bring out the different colors necessary to read the "paper."
Ralph, 124C 41+, glancing over the head-lines of his News, saw that
considerable space was given to his latest exploit, the paper showing
actual photographs of the Swiss Alpine scene, which a
correspondent had taken as the avalanche thundered down the
mountain. The photographs had been sent by Teleradiograph
immediately after the occurrence in Switzerland, and the News had
printed them in all the natural colors twenty minutes after Ralph had
turned off the ultra-power in New York.
These photographs seemed to be the only thing that interested
Ralph, as they showed the house and the surrounding Alps. These,
with the monstrous avalanche in progression photographed and
reproduced in the natural colors, were very impressive.
Presently he revolved the color screen of his projector to green—the
technical page of the News—to him the most interesting reading in
the paper.
He soon had read all that interested him, and as there was still an
hour before dinner time he began to "write" his lecture: "On the
prolongation of animal life by π-Rays."
He attached a double leather head-band to his head. At each end of
the band was attached a round metal disc that pressed closely on
the temples. From each metal disc an insulated wire led to a small
square box, the Menograph, or mind-writer.
He then pressed a button and a low humming was heard;
simultaneously two small bulbs began to glow with a soft green
fluorescent light. Grasping a button connected with a flexible cord to
the Menograph, he leaned back in his chair.
After a few minutes' reflection he pressed the button, and at once a
wave line, traced in ink, appeared on a narrow white fabric band,
the latter resembling a telegraph recorder tape.
The band which moved rapidly, was unrolled from one reel and
rolled up on another. Whenever the inventor wished to "write" down
his thoughts, he would press the button, which started the
mechanism as well as the recording tracer.
(Below is shown the record of a Menograph, the piece of tape being
actual size.
Where the wave line breaks, a new word or sentence commences;
the three words shown are the result of the thought which expresses
itself in the words, "In olden times." ...)
The Menograph was one of Ralph 124C 41+'s earliest inventions,
and entirely superseded the pen and pencil. It was only necessary to
press the button when an idea was to be recorded and to release
the button when one reflected and did not wish the thought-words
recorded.
Instead of writing a letter, one sent the recorded Menotape, and
inasmuch as the Menolphabet was universal and could be read by
anyone—children being taught it at an early age—it was considered
that this invention of Ralph's was one of his greatest gifts to
humanity: Twenty times as much work could be done by means of
the Menograph as could be done by the old-fashioned writing, which
required considerable physical effort. Typewriters soon disappeared
after its invention. Nor was there any use for stenographers, as the
thoughts were written down direct on the tape, which was sent out
as a letter was sent centuries ago.
As was his custom in the evening he worked for some hours in the
laboratory, and retired at midnight. Before he fell asleep he attached
to his head a double leather head-band with metal temple plates,
similar to the one used in connection with the Menograph.
He then called for his man, Peter, and told him to "put on" Homer's
Odyssey for the night.
Peter went down to the library on the 15th floor, and took down
from a shelf a narrow box, labeled Odyssey, Homer. From this he
extracted a large but thin reel on which was wound a long narrow
film. This film was entirely black but for a white transparent wave-
line running through the center of it.
Peter returning to Ralph's bedroom placed the reel containing the
film in a rack and introduced the end of the film into the
Hypnobioscope. This wonderful instrument, invented by Ralph,
transmitted the impulses of the wave-line direct to the brain of the
sleeping inventor, who thus was made to "dream" the Odyssey.
It had been known for centuries that the brain could be affected
during sleep by certain processes. Thus one could be forced to
dream that a heavy object was lying on one's chest, if such an
object was placed on the sleeper's chest. Or one could be forced to
dream that one's hand was being burnt or frozen, simply by heating
or cooling the sleeper's hand.
It remained to Ralph, however, to perfect the Hypnobioscope, which
transmitted words direct to the sleeping brain, in such a manner that
everything could be remembered in detail the next morning.
This was made possible by having the impulses act directly and
steadily on the brain. In other words, it was the Menograph
reversed, with certain additions.
Thus, while in a passive state, the mind absorbed the impressions
quite readily and mechanically and a story "read" by means of the
Hypnobioscope left a much stronger impression than if the same
story had been read while conscious.
For thousands of years humanity had wasted half of its life during
sleep—the negative life. Since Ralph's invention, all this was
changed. Not one night was lost by anyone if anywhere possible,
conditions permitting. All books were read while one slept. Most of
the studying was done while one slept. Some people mastered ten
languages, during their sleep-life. Children who could not be
successfully taught in school during their hours of consciousness,
became good scholars if the lessons were repeated during their
sleep-life.
The morning "newspapers" were transmitted to the sleeping
subscribers by wire at about 5 a.m. The great newspaper offices had
hundreds of Hypnobioscopes in operation, the subscriber's wire
leading to them. The newspaper office, notified by each subscriber
what kind of news is desirable, furnished only such news.
Consequently, when the subscriber woke up for breakfast he already
knew the latest news, and could discuss it with his family, the
members of which were also connected with the newspaper
Hypnobioscope.
FOOTNOTES:
[1] At the time this was written there was no newspaper of that
name.
3
DEAD OR ALIVE?
An apologetic cough came through the entrance to the laboratory. It
was nearing one o'clock of the following day.
Several minutes later it was repeated, to the intense annoyance of
the scientist, who had left orders that he was not to be interrupted
in his work under any circumstances.
At the third "ahem!" he raised his head and stared fixedly at the
empty space between the doorjambs. The most determined optimist
could not have spelled welcome in that look.
Peter, advancing his neck around the corner until one eye met that
of his master, withdrew it hastily.
"Well, what is it?" came from the laboratory, in an irritated harsh
voice.
Peter, in the act of retreating on tiptoe, turned, and once more
cocked a solitary eye around the door-jamb. This one feature had
the beseeching look of a dog trying to convey by his expression that
not for worlds would he have got in the way of your boot.
"Beg pardon, sir, but there's a young—"
"Won't see him!"
"But, sir, it's a young lady—"
"I'm busy, get out!"
Peter gulped desperately. "The young lady from—"
At this moment Ralph pressed a button nearby, an electromagnet
acted, and a heavy plate glass door slid down from above, almost
brushing Peter's melancholy countenance, terminating the
conversation summarily.
Having secured himself against further interruption Ralph returned
to the large glass box over which he had been working, and in which
one could see, through greenish vapors, a dog, across whose heart
was strapped a flat glass box filled with a metal-like substance.
The substance in the box was Radium-K. Radium, which had been
known for centuries, had the curious property of giving out heat for
thousands of years without disintegrating and without apparently
obtaining energy from any outside source.
In 2009, Anatole M610 B9, the great French physicist, found that
Radium obtained all its energy from the ether of space and proved
that Radium was one of the few substances having a very strong
affinity for the ether. Radium, he found, attracted the ether violently
and the latter surging back and forward through the Radium became
charged electrically, presenting all the other well known phenomena.
Anatole M610 B9 compared the action of Radium on the ether with
that of a magnet acting upon a piece of iron. He proved this theory
by examining a piece of pure metallic Radium in an etherless space,
whereupon it lost all its characteristics and acted like a piece of
ordinary metal.
Radium-K, as used by Ralph, was not pure Radium, but an alloy
composed of Radium and Argonium. This alloy exhibited all the usual
phenomena of pure Radium and produced great heat, but did not
create burns on animal tissue. It could be handled freely and without
danger.
The dog lying in the glass box had been "dead" for three years. Just
three years previous, in the presence of twenty noted scientists
Ralph 124C 41+ had exhibited a live dog and had proceeded to drain
off all its blood till the dog was pronounced quite dead and its heart
had stopped beating. Thereupon he had refilled the empty blood
vessels of the animal with a weak solution of Radium-K bromide, and
the large artery through which the solution was pumped into the
body had been closed.
The flat box containing Radium-K was then strapped over the dog's
heart and it was placed in the large glass case. The latter was filled
with Permagatol, a green gas having the property of preserving
animal tissue permanently and indefinitely. The purpose of the box
containing Radium-K was to keep the temperature of the dog's body
at a fixed point.
After the case was completely filled with gas, the glass cover was
sealed in such a manner that it was impossible to open the case
without breaking the seals. The scientists had agreed to return after
a lapse of three years to witness the opening of the box.
There were several delicate instruments inside the box and these
were connected by means of wires to recording instruments on the
side, and these Ralph inspected twice each day. Throughout the
three years the "dead" dog had never stirred a muscle. His
temperature had not varied 1/100 of a degree and his respiratory
functions had shown no signs of life. To all intents and purposes the
dog was "dead."
The time was close at hand for the final stages of what Ralph
considered to be his greatest experiment. Three years ago when he
faced his fellow scientists at the end of the first stage of this work,
he electrified them by announcing that he expected to prove that
this dog, which they had all pronounced "dead," could be restored to
life, unharmed, unchanged, with no more effects upon the dog's
spirits, habits, and nature, than had the animal taken but a short
nap.
For three years this experiment of Ralph 124C 41+ had been the
subject of innumerable scientific papers, had been discussed
intermittently in the newspapers and the date of the final phase of
the great experiment was fixed in the mind of every human being on
the planet.
If the experiment succeeded it meant the prolongation of human life
over greater periods of the earth's history than had ever been
possible. It meant that premature death except through accident
would be ended.
Would he succeed? Had he attempted the impossible? Was he
challenging Nature to a combat only to be worsted?
These thoughts obtruded themselves into his consciousness as he
began the preparations for the great test of the afternoon. He
pumped out the Permagatol from the box until the green vapor had
completely disappeared. With infinite care he then forced a small
quantity of oxygen into the box. The instruments recording the
action of the respiratory organs indicated that the oxygen reaching
the dog's lungs had stimulated respiration.
This being all he could do for the present, he pressed the button
that raised the glass barrier, and summoned Peter by means of
another button.
That individual, looking a trifle more melancholy than usual,
responded at once.
"Well my boy," said Ralph good-humoredly, "the stage is all set for
the experiment that will set the whole world by the ears.—But you
don't look happy, Peter. What's troubling your dear old soul?"
Peter, whose feelings had evidently been lacerated when the door
had been lowered in his face, replied with heavy dignity.
"Beg pardon, sir, but the young lady is still waiting."
"What young lady?" asked Ralph.
"The young lady from Switzerland, sir."
"The—which?"
"The young lady from Switzerland, sir, and her father, sir. They've
been waiting half an hour."
If a bomb had exploded that instant Ralph could not have been
more astounded.
"She's here—and you didn't call me? Peter, there are times when I
am tempted to throw you out—"
"Pardon sir," replied Peter firmly, "I made bold to assume that you
might be interested in the young lady's arrival, and presumed to step
into the laboratory to so inform—"
But his master had gone, shedding his laboratory smock as he went.
Peter, gathering his dignity about him as a garment, reached the
doorway in time to see the elevator slide downwards out of sight.
And in it, Ralph, his heart thumping in a most undignified way, was
acting more like a schoolboy than a master of science. He twitched
at his tie with one hand and smoothed his hair with the other,
peering into the elevator's little mirror anxiously. Discovering a
smudge on his cheek he checked the car between floors while he
wiped away the spot with his handkerchief.
When he reached the reception room he sprang from the elevator
eagerly and hurried in. Seated by one of the windows were Alice
212B 423 and her father. Both turned as he entered, and the girl
rose to her feet and with a charming gesture held out both hands.
"We just had to come," she said prettily, and in perfect English. "You
didn't give us an opportunity to thank you yesterday, and anyhow,
we felt that telephot thanks were not nearly so nice. That is, father
thought we really ought to come in person—of course, I did, too. I
wanted to see you ever so much"—she broke off, and then, realizing
the implication of her words, went on hastily with reddened cheeks
and downcast eyes, "I mean, to—to thank you, you know."
"It was wonderful of you," he declared still holding her two hands,
and utterly unmindful of the fact that she was gently trying to
disengage them. Indeed, he was not conscious of anyone or
anything but her, until the voice of her father brought him to the
realization that there was someone else in the room.
"We need no introduction I think," said the gentleman, "but I am
James 212B 422 and I must ask you to pardon our intrusion upon a
busy scientist's time, but I felt that we should come personally to
thank you for the great service you have done us both. She is my
one daughter, sir, and I love her dearly—dearly—"
"I can quite understand that," said Ralph with an unconscious ardor
that caused Alice, who had completely recovered from her
momentary confusion, to dimple and blush delightfully.
"I'm afraid, father dear," she said, "that we are keeping a busy man
too long. Your man," she added, turning to Ralph, "said you were
engaged in a wonderful experiment, and could not be disturbed."
"Busy? Not at all," said Ralph gracelessly. "You should not have been
kept waiting one moment, and I am very indignant with Peter for not
breaking down the door. He should have known, when he saw you,
that you were not to wait."
"Oh, please, don't scold him because of me," said Alice, not,
however, at all displeased with the implied compliment.
"I didn't know yesterday that you spoke English," he said, "so I used
the language-rectifier, but I see that you speak it perfectly. That is a
great relief to me, I assure you, for I speak French very indifferently.
But tell me," he continued, "how did you get here so soon? The
afternoon transatlantic aeroliner is not due yet, and it can hardly be
twenty-four hours since you left Switzerland."
"We had the honor of being the first passengers to arrive by means
of the new Subatlantic Tube," said James 212B 422. "As you are
doubtless aware, the regular passenger service opens next week,
but being one of the consulting engineers of the new
electromagnetic tube, my daughter and I were permitted to make
the first trip westward. We made it in perfect safety, although it was
a little risky, as some small portions of the tube are not entirely
completed."
"And we were so anxious to get here as quickly as possible," broke
in Alice with a glance at Ralph.
"But you shouldn't have risked your lives, in an untested tube," he
exclaimed. And then, the scientist in him to the front: "Tell me all
about this new tube. Busy with my own work I have not followed its
progress closely enough to know all its details."
"It has been most interesting work," said James 212B 422, "and we
regard it as quite an achievement in electrical engineering. The new
tube runs in a straight line between New York and Brest, France. If
the tube were to run straight along the bottom of the ocean the
distance between the two points would be from 3600 to 3700 miles
due to the curvature of the earth. For this reason the tube was
pushed straight through the earth, thereby making the distance only
3470 miles.
"You will understand it better by examining this chart," and unfolding
a plan, he proceeded to elaborate on the finer points of the tube
construction. "The greatest trouble," he went on, "our engineers
experienced near the middle of the tube; this point is 450 miles
nearer the center of the earth and the heat became very marked. It
was necessary to install large liquid-air plants at several points in the
tube to reduce the heat, and now as you ride through no heat is
noticed.
"We boarded the spacious steel car, which resembles a thick cigar, at
Brest last night at midnight, and arrived at the New York terminal at
noon today. There was only one stop, a few hundred miles out from
Brest, because of several short-circuited electromagnets.
"There are no wheels to the tube car and it is propelled by
magnetism only. At each three hundred feet is stationed a powerful
tubular electromagnet, about thirty feet long, through which the
tube car passes. Each electromagnet exerts a tremendous pull upon
the car three hundred feet away, this being the only steel object,
and the car rushes toward the electromagnet with a tremendous
speed. When the car is only two feet away from this electromagnet,
the current is cut off automatically by the car itself, the latter
plunging through the open space of the magnet coil, only to be
influenced now by the next electromagnet, three hundred feet
distant.
4
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