100% found this document useful (3 votes)
25 views

(eBook PDF) Data Structures & Algorithm Analysis in C++ 4th Editionpdf download

The document is a comprehensive guide to data structures and algorithm analysis using C++, covering various topics such as programming fundamentals, algorithm analysis, lists, trees, hashing, and graph algorithms. It includes detailed explanations, examples, exercises, and references for further study. Additionally, it provides links to download related eBooks and resources.

Uploaded by

tilommondoa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
25 views

(eBook PDF) Data Structures & Algorithm Analysis in C++ 4th Editionpdf download

The document is a comprehensive guide to data structures and algorithm analysis using C++, covering various topics such as programming fundamentals, algorithm analysis, lists, trees, hashing, and graph algorithms. It includes detailed explanations, examples, exercises, and references for further study. Additionally, it provides links to download related eBooks and resources.

Uploaded by

tilommondoa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

(eBook PDF) Data Structures & Algorithm Analysis

in C++ 4th Edition download

https://ebookluna.com/product/ebook-pdf-data-structures-
algorithm-analysis-in-c-4th-edition/

Download more ebook from https://ebookluna.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookluna.com
to discover even more!

Data Structures & Algorithm Analysis in C++ 4th Edition (eBook PDF)

https://ebookluna.com/product/data-structures-algorithm-analysis-in-c-4th-
edition-ebook-pdf/

(eBook PDF) Starting Out with Java: From Control Structures through Data
Structures 4th Edition

https://ebookluna.com/product/ebook-pdf-starting-out-with-java-from-
control-structures-through-data-structures-4th-edition/

Data Structures - eBook PDF

https://ebookluna.com/download/data-structures-ebook-pdf/

C++ Programming. Program Design including Data Structures 8th Edition D.S.
Malik - eBook PDF

https://ebookluna.com/download/c-programming-program-design-including-data-
structures-ebook-pdf/
(eBook PDF) Data Structures and Abstractions with Java 4th Edition

https://ebookluna.com/product/ebook-pdf-data-structures-and-abstractions-
with-java-4th-edition/

(eBook PDF) Data Structures and Abstractions with Java 4th Global Edition

https://ebookluna.com/product/ebook-pdf-data-structures-and-abstractions-
with-java-4th-global-edition/

(eBook PDF) Data Structures and Other Objects Using Java 4th Edition

https://ebookluna.com/product/ebook-pdf-data-structures-and-other-objects-
using-java-4th-edition/

(eBook PDF) Data Structures and Problem Solving Using Java 4th Edition

https://ebookluna.com/product/ebook-pdf-data-structures-and-problem-
solving-using-java-4th-edition/

Data Structures & Algorithms in Python 1st Edition John Canning - eBook PDF

https://ebookluna.com/download/data-structures-algorithms-in-python-ebook-
pdf-2/
CO NTE NTS

Preface xv

Chapter 1 Programming: A General Overview 1


1.1 What’s This 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 C++ Classes 12
1.4.1 Basic class Syntax 12
1.4.2 Extra Constructor Syntax and Accessors 13
1.4.3 Separation of Interface and Implementation 16
1.4.4 vector and string 19
1.5 C++ Details 21
1.5.1 Pointers 21
1.5.2 Lvalues, Rvalues, and References 23
1.5.3 Parameter Passing 25
1.5.4 Return Passing 27
1.5.5 std::swap and std::move 29
1.5.6 The Big-Five: Destructor, Copy Constructor, Move Constructor, Copy
Assignment operator=, Move Assignment operator= 30
1.5.7 C-style Arrays and Strings 35
1.6 Templates 36
1.6.1 Function Templates 37
1.6.2 Class Templates 38
1.6.3 Object, Comparable, and an Example 39
1.6.4 Function Objects 41
1.6.5 Separate Compilation of Class Templates 44
1.7 Using Matrices 44
1.7.1 The Data Members, Constructor, and Basic Accessors 44
1.7.2 operator[] 45
vii
viii Contents

1.7.3 Big-Five 46
Summary 46
Exercises 46
References 48

Chapter 2 Algorithm Analysis 51


2.1 Mathematical Background 51
2.2 Model 54
2.3 What to Analyze 54
2.4 Running-Time Calculations 57
2.4.1 A Simple Example 58
2.4.2 General Rules 58
2.4.3 Solutions for the Maximum Subsequence
Sum Problem 60
2.4.4 Logarithms in the Running Time 66
2.4.5 Limitations of Worst-Case Analysis 70
Summary 70
Exercises 71
References 76

Chapter 3 Lists, Stacks, and Queues 77


3.1 Abstract Data Types (ADTs) 77
3.2 The List ADT 78
3.2.1 Simple Array Implementation of Lists 78
3.2.2 Simple Linked Lists 79
3.3 vector and list in the STL 80
3.3.1 Iterators 82
3.3.2 Example: Using erase on a List 83
3.3.3 const_iterators 84
3.4 Implementation of vector 86
3.5 Implementation of list 91
3.6 The Stack ADT 103
3.6.1 Stack Model 103
3.6.2 Implementation of Stacks 104
3.6.3 Applications 104
3.7 The Queue ADT 112
3.7.1 Queue Model 113
3.7.2 Array Implementation of Queues 113
3.7.3 Applications of Queues 115
Summary 116
Exercises 116
Contents ix

Chapter 4 Trees 121


4.1 Preliminaries 121
4.1.1 Implementation of Trees 122
4.1.2 Tree Traversals with an Application 123
4.2 Binary Trees 126
4.2.1 Implementation 128
4.2.2 An Example: Expression Trees 128
4.3 The Search Tree ADT—Binary Search Trees 132
4.3.1 contains 134
4.3.2 findMin and findMax 135
4.3.3 insert 136
4.3.4 remove 139
4.3.5 Destructor and Copy Constructor 141
4.3.6 Average-Case Analysis 141
4.4 AVL Trees 144
4.4.1 Single Rotation 147
4.4.2 Double Rotation 149
4.5 Splay Trees 158
4.5.1 A Simple Idea (That Does Not Work) 158
4.5.2 Splaying 160
4.6 Tree Traversals (Revisited) 166
4.7 B-Trees 168
4.8 Sets and Maps in the Standard Library 173
4.8.1 Sets 173
4.8.2 Maps 174
4.8.3 Implementation of set and map 175
4.8.4 An Example That Uses Several Maps 176
Summary 181
Exercises 182
References 189

Chapter 5 Hashing 193


5.1 General Idea 193
5.2 Hash Function 194
5.3 Separate Chaining 196
5.4 Hash Tables without Linked Lists 201
5.4.1 Linear Probing 201
5.4.2 Quadratic Probing 202
5.4.3 Double Hashing 207
5.5 Rehashing 208
5.6 Hash Tables in the Standard Library 210
x Contents

5.7 Hash Tables with Worst-Case O(1) Access 212


5.7.1 Perfect Hashing 213
5.7.2 Cuckoo Hashing 215
5.7.3 Hopscotch Hashing 227
5.8 Universal Hashing 230
5.9 Extendible Hashing 233
Summary 236
Exercises 237
References 241

Chapter 6 Priority Queues (Heaps) 245


6.1 Model 245
6.2 Simple Implementations 246
6.3 Binary Heap 247
6.3.1 Structure Property 247
6.3.2 Heap-Order Property 248
6.3.3 Basic Heap Operations 249
6.3.4 Other Heap Operations 252
6.4 Applications of Priority Queues 257
6.4.1 The Selection Problem 258
6.4.2 Event Simulation 259
6.5 d-Heaps 260
6.6 Leftist Heaps 261
6.6.1 Leftist Heap Property 261
6.6.2 Leftist Heap Operations 262
6.7 Skew Heaps 269
6.8 Binomial Queues 271
6.8.1 Binomial Queue Structure 271
6.8.2 Binomial Queue Operations 271
6.8.3 Implementation of Binomial Queues 276
6.9 Priority Queues in the Standard Library 282
Summary 283
Exercises 283
References 288

Chapter 7 Sorting 291


7.1 Preliminaries 291
7.2 Insertion Sort 292
7.2.1 The Algorithm 292
7.2.2 STL Implementation of Insertion Sort 293
7.2.3 Analysis of Insertion Sort 294
7.3 A Lower Bound for Simple Sorting Algorithms 295
Contents xi

7.4 Shellsort 296


7.4.1 Worst-Case Analysis of Shellsort 297
7.5 Heapsort 300
7.5.1 Analysis of Heapsort 301
7.6 Mergesort 304
7.6.1 Analysis of Mergesort 306
7.7 Quicksort 309
7.7.1 Picking the Pivot 311
7.7.2 Partitioning Strategy 313
7.7.3 Small Arrays 315
7.7.4 Actual Quicksort Routines 315
7.7.5 Analysis of Quicksort 318
7.7.6 A Linear-Expected-Time Algorithm for Selection 321
7.8 A General Lower Bound for Sorting 323
7.8.1 Decision Trees 323
7.9 Decision-Tree Lower Bounds for Selection Problems 325
7.10 Adversary Lower Bounds 328
7.11 Linear-Time Sorts: Bucket Sort and Radix Sort 331
7.12 External Sorting 336
7.12.1 Why We Need New Algorithms 336
7.12.2 Model for External Sorting 336
7.12.3 The Simple Algorithm 337
7.12.4 Multiway Merge 338
7.12.5 Polyphase Merge 339
7.12.6 Replacement Selection 340
Summary 341
Exercises 341
References 347

Chapter 8 The Disjoint Sets Class 351


8.1 Equivalence Relations 351
8.2 The Dynamic Equivalence Problem 352
8.3 Basic Data Structure 353
8.4 Smart Union Algorithms 357
8.5 Path Compression 360
8.6 Worst Case for Union-by-Rank and Path Compression 361
8.6.1 Slowly Growing Functions 362
8.6.2 An Analysis by Recursive Decomposition 362
8.6.3 An O( M log * N ) Bound 369
8.6.4 An O( M α(M, N) ) Bound 370
8.7 An Application 372
xii Contents

Summary 374
Exercises 375
References 376

Chapter 9 Graph Algorithms 379


9.1 Definitions 379
9.1.1 Representation of Graphs 380
9.2 Topological Sort 382
9.3 Shortest-Path Algorithms 386
9.3.1 Unweighted Shortest Paths 387
9.3.2 Dijkstra’s Algorithm 391
9.3.3 Graphs with Negative Edge Costs 400
9.3.4 Acyclic Graphs 400
9.3.5 All-Pairs Shortest Path 404
9.3.6 Shortest Path Example 404
9.4 Network Flow Problems 406
9.4.1 A Simple Maximum-Flow Algorithm 408
9.5 Minimum Spanning Tree 413
9.5.1 Prim’s Algorithm 414
9.5.2 Kruskal’s Algorithm 417
9.6 Applications of Depth-First Search 419
9.6.1 Undirected Graphs 420
9.6.2 Biconnectivity 421
9.6.3 Euler Circuits 425
9.6.4 Directed Graphs 429
9.6.5 Finding Strong Components 431
9.7 Introduction to NP-Completeness 432
9.7.1 Easy vs. Hard 433
9.7.2 The Class NP 434
9.7.3 NP-Complete Problems 434
Summary 437
Exercises 437
References 445

Chapter 10 Algorithm Design Techniques 449


10.1 Greedy Algorithms 449
10.1.1 A Simple Scheduling Problem 450
10.1.2 Huffman Codes 453
10.1.3 Approximate Bin Packing 459
10.2 Divide and Conquer 467
10.2.1 Running Time of Divide-and-Conquer Algorithms 468
10.2.2 Closest-Points Problem 470
Contents xiii

10.2.3 The Selection Problem 475


10.2.4 Theoretical Improvements for Arithmetic Problems 478
10.3 Dynamic Programming 482
10.3.1 Using a Table Instead of Recursion 483
10.3.2 Ordering Matrix Multiplications 485
10.3.3 Optimal Binary Search Tree 487
10.3.4 All-Pairs Shortest Path 491
10.4 Randomized Algorithms 494
10.4.1 Random-Number Generators 495
10.4.2 Skip Lists 500
10.4.3 Primality Testing 503
10.5 Backtracking Algorithms 506
10.5.1 The Turnpike Reconstruction Problem 506
10.5.2 Games 511
Summary 518
Exercises 518
References 527

Chapter 11 Amortized Analysis 533


11.1 An Unrelated Puzzle 534
11.2 Binomial Queues 534
11.3 Skew Heaps 539
11.4 Fibonacci Heaps 541
11.4.1 Cutting Nodes in Leftist Heaps 542
11.4.2 Lazy Merging for Binomial Queues 544
11.4.3 The Fibonacci Heap Operations 548
11.4.4 Proof of the Time Bound 549
11.5 Splay Trees 551
Summary 555
Exercises 556
References 557

Chapter 12 Advanced Data Structures


and Implementation 559
12.1 Top-Down Splay Trees 559
12.2 Red-Black Trees 566
12.2.1 Bottom-Up Insertion 567
12.2.2 Top-Down Red-Black Trees 568
12.2.3 Top-Down Deletion 570
12.3 Treaps 576
xiv Contents

12.4 Suffix Arrays and Suffix Trees 579


12.4.1 Suffix Arrays 580
12.4.2 Suffix Trees 583
12.4.3 Linear-Time Construction of Suffix Arrays and Suffix Trees 586
12.5 k-d Trees 596
12.6 Pairing Heaps 602
Summary 606
Exercises 608
References 612

Appendix A Separate Compilation of


Class Templates 615
A.1 Everything in the Header 616
A.2 Explicit Instantiation 616

Index 619
P R E FAC E

Purpose/Goals
The fourth edition of Data Structures and Algorithm Analysis in C++ describes data structures,
methods of organizing large amounts of data, and algorithm analysis, the estimation of the
running time of algorithms. As computers become faster and faster, the need for programs
that can handle large amounts of input becomes more acute. Paradoxically, this requires
more careful attention to efficiency, since inefficiencies in programs become most obvious
when input sizes are large. By analyzing an algorithm before it is actually coded, students
can decide if a particular solution will be feasible. For example, in this text students look at
specific problems and see how careful implementations can reduce the time constraint for
large amounts of data from centuries to less than a second. Therefore, no algorithm or data
structure is presented without an explanation of its running time. In some cases, minute
details that affect the running time of the implementation are explored.
Once a solution method is determined, a program must still be written. As computers
have become more powerful, the problems they must solve have become larger and more
complex, requiring development of more intricate programs. The goal of this text is to teach
students good programming and algorithm analysis skills simultaneously so that they can
develop such programs with the maximum amount of efficiency.
This book is suitable for either an advanced data structures course or a first-year
graduate course in algorithm analysis. Students should have some knowledge of inter-
mediate programming, including such topics as pointers, recursion, and object-based
programming, as well as some background in discrete math.

Approach
Although the material in this text is largely language-independent, programming requires
the use of a specific language. As the title implies, we have chosen C++ for this book.
C++ has become a leading systems programming language. In addition to fixing many
of the syntactic flaws of C, C++ provides direct constructs (the class and template) to
implement generic data structures as abstract data types.
The most difficult part of writing this book was deciding on the amount of C++ to
include. Use too many features of C++ and one gets an incomprehensible text; use too few
and you have little more than a C text that supports classes.
The approach we take is to present the material in an object-based approach. As such,
there is almost no use of inheritance in the text. We use class templates to describe generic
data structures. We generally avoid esoteric C++ features and use the vector and string
classes that are now part of the C++ standard. Previous editions have implemented class
templates by separating the class template interface from its implementation. Although
this is arguably the preferred approach, it exposes compiler problems that have made it xv
xvi Preface

difficult for readers to actually use the code. As a result, in this edition the online code
represents class templates as a single unit, with no separation of interface and implementa-
tion. Chapter 1 provides a review of the C++ features that are used throughout the text and
describes our approach to class templates. Appendix A describes how the class templates
could be rewritten to use separate compilation.
Complete versions of the data structures, in both C++ and Java, are available on
the Internet. We use similar coding conventions to make the parallels between the two
languages more evident.

Summary of the Most Significant Changes in the Fourth Edition


The fourth edition incorporates numerous bug fixes, and many parts of the book have
undergone revision to increase the clarity of presentation. In addition,

r Chapter 4 includes implementation of the AVL tree deletion algorithm—a topic often
requested by readers.
r Chapter 5 has been extensively revised and enlarged and now contains material on
two newer algorithms: cuckoo hashing and hopscotch hashing. Additionally, a new
section on universal hashing has been added. Also new is a brief discussion of the
unordered_set and unordered_map class templates introduced in C++11.
r Chapter 6 is mostly unchanged; however, the implementation of the binary heap makes
use of move operations that were introduced in C++11.
r Chapter 7 now contains material on radix sort, and a new section on lower-bound
proofs has been added. Sorting code makes use of move operations that were
introduced in C++11.
r Chapter 8 uses the new union/find analysis by Seidel and Sharir and shows the
O( M α(M, N) ) bound instead of the weaker O( M log∗ N ) bound in prior editions.
r Chapter 12 adds material on suffix trees and suffix arrays, including the linear-time
suffix array construction algorithm by Karkkainen and Sanders (with implementation).
The sections covering deterministic skip lists and AA-trees have been removed.
r Throughout the text, the code has been updated to use C++11. Notably, this means
use of the new C++11 features, including the auto keyword, the range for loop, move
construction and assignment, and uniform initialization.

Overview
Chapter 1 contains review material on discrete math and recursion. I believe the only way
to be comfortable with recursion is to see good uses over and over. Therefore, recursion
is prevalent in this text, with examples in every chapter except Chapter 5. Chapter 1 also
includes material that serves as a review of basic C++. Included is a discussion of templates
and important constructs in C++ class design.
Chapter 2 deals with algorithm analysis. This chapter explains asymptotic analysis
and its major weaknesses. Many examples are provided, including an in-depth explana-
tion of logarithmic running time. Simple recursive programs are analyzed by intuitively
converting them into iterative programs. More complicated divide-and-conquer programs
are introduced, but some of the analysis (solving recurrence relations) is implicitly delayed
until Chapter 7, where it is performed in detail.
Preface xvii

Chapter 3 covers lists, stacks, and queues. This chapter includes a discussion of the STL
vector and list classes, including material on iterators, and it provides implementations
of a significant subset of the STL vector and list classes.
Chapter 4 covers trees, with an emphasis on search trees, including external search
trees (B-trees). The UNIX file system and expression trees are used as examples. AVL trees
and splay trees are introduced. More careful treatment of search tree implementation details
is found in Chapter 12. Additional coverage of trees, such as file compression and game
trees, is deferred until Chapter 10. Data structures for an external medium are considered
as the final topic in several chapters. Included is a discussion of the STL set and map classes,
including a significant example that illustrates the use of three separate maps to efficiently
solve a problem.
Chapter 5 discusses hash tables, including the classic algorithms such as sepa-
rate chaining and linear and quadratic probing, as well as several newer algorithms,
namely cuckoo hashing and hopscotch hashing. Universal hashing is also discussed, and
extendible hashing is covered at the end of the chapter.
Chapter 6 is about priority queues. Binary heaps are covered, and there is additional
material on some of the theoretically interesting implementations of priority queues. The
Fibonacci heap is discussed in Chapter 11, and the pairing heap is discussed in Chapter 12.
Chapter 7 covers sorting. It is very specific with respect to coding details and analysis.
All the important general-purpose sorting algorithms are covered and compared. Four
algorithms are analyzed in detail: insertion sort, Shellsort, heapsort, and quicksort. New to
this edition is radix sort and lower bound proofs for selection-related problems. External
sorting is covered at the end of the chapter.
Chapter 8 discusses the disjoint set algorithm with proof of the running time. This is a
short and specific chapter that can be skipped if Kruskal’s algorithm is not discussed.
Chapter 9 covers graph algorithms. Algorithms on graphs are interesting, not only
because they frequently occur in practice but also because their running time is so heavily
dependent on the proper use of data structures. Virtually all of the standard algorithms
are presented along with appropriate data structures, pseudocode, and analysis of running
time. To place these problems in a proper context, a short discussion on complexity theory
(including NP-completeness and undecidability) is provided.
Chapter 10 covers algorithm design by examining common problem-solving tech-
niques. This chapter is heavily fortified with examples. Pseudocode is used in these later
chapters so that the student’s appreciation of an example algorithm is not obscured by
implementation details.
Chapter 11 deals with amortized analysis. Three data structures from Chapters 4 and
6 and the Fibonacci heap, introduced in this chapter, are analyzed.
Chapter 12 covers search tree algorithms, the suffix tree and array, the k-d tree, and
the pairing heap. This chapter departs from the rest of the text by providing complete and
careful implementations for the search trees and pairing heap. The material is structured so
that the instructor can integrate sections into discussions from other chapters. For example,
the top-down red-black tree in Chapter 12 can be discussed along with AVL trees (in
Chapter 4).
Chapters 1 to 9 provide enough material for most one-semester data structures courses.
If time permits, then Chapter 10 can be covered. A graduate course on algorithm analysis
could cover chapters 7 to 11. The advanced data structures analyzed in Chapter 11 can
easily be referred to in the earlier chapters. The discussion of NP-completeness in Chapter 9
xviii Preface

is far too brief to be used in such a course. You might find it useful to use an additional
work on NP-completeness to augment this text.

Exercises
Exercises, provided at the end of each chapter, match the order in which material is pre-
sented. The last exercises may address the chapter as a whole rather than a specific section.
Difficult exercises are marked with an asterisk, and more challenging exercises have two
asterisks.

References
References are placed at the end of each chapter. Generally the references either are his-
torical, representing the original source of the material, or they represent extensions and
improvements to the results given in the text. Some references represent solutions to
exercises.

Supplements
The following supplements are available to all readers at http://cssupport.pearsoncmg.com/

r Source code for example programs


r Errata

In addition, the following material is available only to qualified instructors at Pearson


Instructor Resource Center (www.pearsonhighered.com/irc). Visit the IRC or contact your
Pearson Education sales representative for access.

r Solutions to selected exercises


r Figures from the book
r Errata

Acknowledgments
Many, many people have helped me in the preparation of books in this series. Some are
listed in other versions of the book; thanks to all.
As usual, the writing process was made easier by the professionals at Pearson. I’d like
to thank my editor, Tracy Johnson, and production editor, Marilyn Lloyd. My wonderful
wife Jill deserves extra special thanks for everything she does.
Finally, I’d like to thank the numerous readers who have sent e-mail messages and
pointed out errors or inconsistencies in earlier versions. My website www.cis.fiu.edu/~weiss
will also contain updated source code (in C++ and Java), an errata list, and a link to submit
bug reports.
M.A.W.
Miami, Florida
C H A P T E R 1

Programming: A General
Overview

In this chapter, we discuss the aims and goals of this text and briefly review programming
concepts and discrete mathematics. We will . . .

r See that how a program performs for reasonably large input is just as important as its
performance on moderate amounts of input.
r Summarize the basic mathematical background needed for the rest of the book.
r Briefly review recursion.
r Summarize some important features of C++ that are used throughout the text.

1.1 What’s This Book About?


Suppose you have a group of N numbers and would like to determine the kth largest. This
is known as the selection problem. Most students who have had a programming course
or two would have no difficulty writing a program to solve this problem. There are quite a
few “obvious” solutions.
One way to solve this problem would be to read the N numbers into an array, sort the
array in decreasing order by some simple algorithm such as bubble sort, and then return
the element in position k.
A somewhat better algorithm might be to read the first k elements into an array and
sort them (in decreasing order). Next, each remaining element is read one by one. As a new
element arrives, it is ignored if it is smaller than the kth element in the array. Otherwise, it
is placed in its correct spot in the array, bumping one element out of the array. When the
algorithm ends, the element in the kth position is returned as the answer.
Both algorithms are simple to code, and you are encouraged to do so. The natural ques-
tions, then, are: Which algorithm is better? And, more important, Is either algorithm good
enough? A simulation using a random file of 30 million elements and k = 15,000,000
will show that neither algorithm finishes in a reasonable amount of time; each requires
several days of computer processing to terminate (albeit eventually with a correct answer).
An alternative method, discussed in Chapter 7, gives a solution in about a second. Thus,
although our proposed algorithms work, they cannot be considered good algorithms, 1
2 Chapter 1 Programming: A General Overview

1 2 3 4

1 t h i s
2 w a t s
3 o a h g
4 f g d t

Figure 1.1 Sample word puzzle

because they are entirely impractical for input sizes that a third algorithm can handle in a
reasonable amount of time.
A second problem is to solve a popular word puzzle. The input consists of a two-
dimensional array of letters and a list of words. The object is to find the words in the puzzle.
These words may be horizontal, vertical, or diagonal in any direction. As an example, the
puzzle shown in Figure 1.1 contains the words this, two, fat, and that. The word this begins
at row 1, column 1, or (1,1), and extends to (1,4); two goes from (1,1) to (3,1); fat goes
from (4,1) to (2,3); and that goes from (4,4) to (1,1).
Again, there are at least two straightforward algorithms that solve the problem. For each
word in the word list, we check each ordered triple (row, column, orientation) for the pres-
ence of the word. This amounts to lots of nested for loops but is basically straightforward.
Alternatively, for each ordered quadruple (row, column, orientation, number of characters)
that doesn’t run off an end of the puzzle, we can test whether the word indicated is in the
word list. Again, this amounts to lots of nested for loops. It is possible to save some time
if the maximum number of characters in any word is known.
It is relatively easy to code up either method of solution and solve many of the real-life
puzzles commonly published in magazines. These typically have 16 rows, 16 columns, and
40 or so words. Suppose, however, we consider the variation where only the puzzle board is
given and the word list is essentially an English dictionary. Both of the solutions proposed
require considerable time to solve this problem and therefore might not be acceptable.
However, it is possible, even with a large word list, to solve the problem very quickly.
An important concept is that, in many problems, writing a working program is not
good enough. If the program is to be run on a large data set, then the running time becomes
an issue. Throughout this book we will see how to estimate the running time of a program
for large inputs and, more important, how to compare the running times of two programs
without actually coding them. We will see techniques for drastically improving the speed
of a program and for determining program bottlenecks. These techniques will enable us to
find the section of the code on which to concentrate our optimization efforts.

1.2 Mathematics Review


This section lists some of the basic formulas you need to memorize, or be able to derive,
and reviews basic proof techniques.
Discovering Diverse Content Through
Random Scribd Documents
of a new life, while, for myself, a weight was rolled from my heart,
and I thanked God that a difficulty was solved which, for years, had
oppressed me with anxiety.
After this nothing was thought of but making preparations for the
departure of the dear ones bound for England. Captain Littlestone
allowed as much time as he could spare; but it was necessarily
short, so that incessant movement and industry pervaded the
settlement for several days.
Everything was provided and packed up that could in any way add
to our children's comfort on the voyage, or benefit them after their
arrival in England, and a large share of my possessions in pearls,
corals, furs, spices, and other valuables would enable them to take a
good position in the world of commerce.
I committed to their care private papers, money, and jewels which
I knew to have been the personal property of the captain of our ill-
fated ship, desiring them to hand them over, if possible, to his heirs.
A short account of the wreck, with the names of the crew, a list of
which I had found, was given to Captain Littlestone.
Fritz, having previously made known to me, what indeed was very
evident, the attachment between himself and Jenny, I advised him
to mention it to Colonel Montrose as soon as possible after being
introduced to him, and ask for his sanction to their engagement. I,
on my part, gladly bestowing mine, as did his mother, who loved the
sweet girl dearly, and heartily grieved to part with her.
On the evening before our separation, I gave to Fritz the journal in
which, ever since the shipwreck, I had chronicled the events of our
life, desiring that the story might be printed and published.
"It was written, as you well know," said I, "for the instruction and
amusement of my children, but it is very possible that it may be
useful to other young people, more especially to boys.
"Children are, on the whole, very much alike everywhere, and you
four lads fairly represent multitudes, who are growing up in all
directions. It will make me happy to think that my simple narrative
may lead some of these to observe how blessed are the results of
patient continuance in well-doing, what benefits arise from the
thoughtful application of knowledge and science, and how good and
pleasant a thing it is when brethren dwell together in unity, under
the eye of parental love."

Night has closed around me.


For the last time my united family slumbers beneath my care.
To-morrow this closing chapter of my journey will pass into the
hands of my eldest son.
From afar I greet thee, Europe!
I greet thee, dear old Switzerland!
Like thee, may New Switzerland flourish and prosper—good,
happy, and free!

THE END.
HAL KEEN MYSTERY STORIES
By HUGH LLOYD

Boys! Meet Hal Keen, that lanky, nonchalant, redheaded


youth whose guiding star is the star that points to adventure,
excitement and mystery. Follow him in his hunts for clues and
criminals. There are plenty of thrills and shivers in these
stories to keep you on your toes.
THE SMUGGLER'S SECRET
Hal Keen sets out to get to the bottom of a mystery that
threatens the safety of a whole community.
THE MYSTERIOUS ARAB
Mystery, excitement, murder in a scientist's camp in the
jungles of Africa, where hate, revenge, and suspicion lead to
tragedy.
THE HERMIT OF GORDON'S CREEK
The disappearance of two airmail pilots leads to a mystery
that centers about an abandoned mine and a strange old
man.
KIDNAPPED IN THE JUNGLE
A hint of buried treasure in the ruins of an old French
mission leads Hal deep into the Central American jungle.
THE COPPERHEAD TRAIL MYSTERY
Baffling and blood-curdling events center about the ranch
where Hal Keen and his friends had gone in search of gold.
THE LONESOME SWAMP MYSTERY
The lonely and mysterious swamp gave up its secret only
after a series of terrifying events taxed Hal's courage and
ability.
THE CLUE AT SKELETON ROCKS
In this new thriller Hal Keen finds mystery and adventure in
and about a lonely lighthouse on Skeleton Rocks, off the
Maine coast.
THE DOOM OF STARK HOUSE
Mystery and terror in an old house in the wilderness above
Quebec where Hal Keen is the guest of a strange family.

GROSSET & DUNLAP, Publishers, NEW YORK

ADVENTURES in the UNKNOWN


By CARL H. CLAUDY

Weird! Mysterious! Incredible! Astounding!


Leap back a million years into the dark prehistoric ages.
Speed through the dangers of outer space beyond the
stratosphere at a thousand miles a minute. Meet the
grotesque machine men of Mars. Break into the bounds of the
Fourth Dimension. You will meet in these thrilling, fascinating
stories many incredible beings and astounding sights that will
stagger your imagination.
THE MYSTERY MEN OF MARS
Seventy million miles from home! Three men—a daring
scientist and two adventurous boys—take off from the earth
in a steel and aluminum sphere that sails through space at 20
miles a second. On the planet Mars they face destruction at
the hands of beings who resemble mechanical bugs more
than men!
A THOUSAND YEARS A MINUTE
In the world of a million years ago—whence they have
been propelled by an old professor's invention—Alan and Ted
find themselves pitted against the dinosaurs, mammoths and
savage ape men of a lost world.
THE LAND OF NO SHADOW
Through a violet coil frame in Professor Arronson's
laboratory Ted and Alan leap into the gray and terrifying land
of the Fourth Dimension. There they are shadowed by the
ghostly forms of menacing, bodiless shapes!

GROSSET & DUNLAP, Publishers, NEW YORK

ZANE GREY BOOKS FOR BOYS

Packed with all the thrill and color and


action that have made this author famous!

THE "KEN WARD" STORIES STORIES OF


The Young The Young BASEBALL
Forester Pitcher
Zane Grey's
Kenneth Ward, a When Ken Ward baseball is as real,
young eastern lad entered Wayne as dramatic and as
just out of College to pursue thrilling as the
preparatory his study of western stories
school, goes west forestry he that made him
on his summer discovered that as famous.
vacation to join a a freshman he was
friend, Dick on the bottom The Redheaded
Leslie, a rung and had to Outfield
government fight to win his
forest ranger in way to recognition. The Redheaded
Arizona. Ken, His first claim to Outfield—three
honest, loyal but fame comes when fiery-pated players
hot-headed runs he pummels a who introduce a
into plenty of prominent little boxing and
excitement and sophomore in self- plenty of comedy
trouble when he defense. into the game will
finds that a big delight you. The
lumber steal is Ken Ward in the Rube—who is all
going on. Jungle that a rube should
be—appears in a
The Young Lion Ken Ward and his whole series of
Hunter younger brother these stories and
Hal take a trip into is a character you
Ken Ward and his the wilds of Mexico won't forget.
kid brother, Hal, —Ken to try his
spend a summer hand at field work The Short-Stop
on a forest in the jungle and
preserve in Utah Hal, who is Chase Alloway
with Ken's pal ambitious to developed a mean
Dick Leslie. The become a curve that had the
government naturalist, to small town players
rangers are out collect specimens. buffaloed. They
after the The boys set out called him
mountain lions to solve the "Chaseaway", the
and the boys from mysteries of the "Hoodoo" and
the east are glad Santa Rosa River, "crooked eye" and
to share in the an unknown one small town
thrilling work. course of about a team was all for
hundred and having him tarred
seventy-five miles and feathered! A
story crowded with
through uncharted hard and fast
jungle. baseball—and a
dash of romance!
STORIES OF THE GREAT WEST
The Last of the Roping Lions in The Last of the
Plainsmen the Grand Great Scouts
Canyon
"He'd rope the devil The life story of
and tie him down— A true story of "Buffalo Bill" by
if the lasso didn't Zane Grey's HELEN CODY
burn," it was said experiences WETMORE
of "Buffalo Jones," capturing lions With Foreword and
one of the last of alive, which makes Conclusion by
the famous ordinary hunting Zane Grey. "Buffalo
plainsmen who trod with guns seem, in Bill"—scout,
the trails of the old contrast about as pathfinder, hunter
West. Killing was exciting as a and Indian fighter
repulsive to him Sunday-school is the most famous
and the passion of picnic. The account of all that great
his life was to of how they company of
capture wild beasts captured six of the frontiersmen who
alive. A real tawny, fiery-eyed opened up the
hunting trip—with demons which West for
constant danger infest the bottom civilization. Indeed
threatening from of the Grand no character in
wild beasts, Indians Canyon, and got history makes a
and the hazards of them into camp stronger appeal to
wild country alive and growling, the imagination
untouched by will enthrall the than this daring
civilization. great host of Zane hero of the old
Grey's boy readers. west.

GROSSET & DUNLAP, Publishers, NEW YORK


The AIR COMBAT STORIES for BOYS
By THOMSON BURTIS
Author of
The Rex Lee Stories

Zooming into the war scene comes this new hero of the air,
Lieutenant Rudford Riley, who leads The Phantom Five, a
group of airmen detailed for special duty in the Royal Flying
Corps during the early days of the war when every take-off
was an impudent challenge to death. The record of their mad
exploits over the front makes breathless reading, and their
adventures have the ring of truth in them for the author-flyer
takes them from his own rich experience as a war-time
aviator.
DAREDEVILS OF THE AIR
Recounts Lieutenant Riley's adventures as leader of The
Phantom Five against the enemy in the air.
FOUR ACES
As commanding officer of Special Flight A, Rud Riley and
Jerry Lacey, the Manhattan Madman, are thrown into the
thickest and hottest of the air fighting.
WING FOR WING
Continues the record of the daredevil young airman's
adventures as one of the leading aces in the war.
FLYING BLACK BIRDS
Stormy Lake leads a squadron of picked daredevils called
the Black Birds against the famous German Red Devils led by
Von Baer.
GROSSET & DUNLAP, Publishers, NEW YORK

Transcriber's Note.
A few typographical, punctuation and spelling
errors have been corrected.
*** END OF THE PROJECT GUTENBERG EBOOK THE SWISS FAMILY
ROBINSON: A TRANSLATION FROM THE ORIGINAL GERMAN ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
back
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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookluna.com

You might also like