100% found this document useful (5 votes)
26 views

Data Structure and Algorithms Using C++: A Practical Implementation 1st Edition Sachi Nandan Mohanty All Chapter Instant Download

Algorithms

Uploaded by

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

Data Structure and Algorithms Using C++: A Practical Implementation 1st Edition Sachi Nandan Mohanty All Chapter Instant Download

Algorithms

Uploaded by

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

Download the full version of the textbook now at textbookfull.

com

Data Structure and Algorithms Using C++: A


Practical Implementation 1st Edition Sachi
Nandan Mohanty

https://textbookfull.com/product/data-structure-
and-algorithms-using-c-a-practical-
implementation-1st-edition-sachi-nandan-mohanty/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Recommender System with Machine Learning and Artificial


Intelligence Practical Tools and Applications in Medical
Agricultural and Other Industries 1st Edition Sachi Nandan
Mohanty (Editor)
https://textbookfull.com/product/recommender-system-with-machine-
learning-and-artificial-intelligence-practical-tools-and-applications-
in-medical-agricultural-and-other-industries-1st-edition-sachi-nandan-
mohanty-editor/
textbookfull.com

Primary Mathematics Textbook 2B Jennifer Hoerst

https://textbookfull.com/product/primary-mathematics-
textbook-2b-jennifer-hoerst/

textbookfull.com

Handbook of Macroeconomics, Volume 2A-2B SET 1st Edition


John B. Taylor

https://textbookfull.com/product/handbook-of-macroeconomics-
volume-2a-2b-set-1st-edition-john-b-taylor/

textbookfull.com

Imposed Rationality and Besieged Imagination Practical


Life and Social Pathologies Gustavo Pereira

https://textbookfull.com/product/imposed-rationality-and-besieged-
imagination-practical-life-and-social-pathologies-gustavo-pereira/

textbookfull.com
The Statesman and the Storyteller: John Hay, Mark Twain,
and the Rise of American Imperialism Zwonitzer

https://textbookfull.com/product/the-statesman-and-the-storyteller-
john-hay-mark-twain-and-the-rise-of-american-imperialism-zwonitzer/

textbookfull.com

Design User Experience and Usability Designing Pleasurable


Experiences 6th International Conference DUXU 2017 Held as
Part of HCI International 2017 Vancouver BC Canada July 9
14 2017 Proceedings Part II 1st Edition Aaron Marcus
https://textbookfull.com/product/design-user-experience-and-usability-
designing-pleasurable-experiences-6th-international-conference-
duxu-2017-held-as-part-of-hci-international-2017-vancouver-bc-canada-
july-9-14-2017-proceedings-part/
textbookfull.com

Research First Edition Philip Kerr

https://textbookfull.com/product/research-first-edition-philip-kerr/

textbookfull.com

Girls' night in First Edition Jessica Adams

https://textbookfull.com/product/girls-night-in-first-edition-jessica-
adams/

textbookfull.com

Entrepreneurship Education Experiments with Curriculum


Pedagogy and Target Groups 1st Edition Mathew J. Manimala

https://textbookfull.com/product/entrepreneurship-education-
experiments-with-curriculum-pedagogy-and-target-groups-1st-edition-
mathew-j-manimala/
textbookfull.com
Palestinian Chicago Identity in Exile 1st Edition Loren D.
Lybarger

https://textbookfull.com/product/palestinian-chicago-identity-in-
exile-1st-edition-loren-d-lybarger/

textbookfull.com
Data Structure and Algorithms
Using C++
Scrivener Publishing
100 Cummings Center, Suite 541J
Beverly, MA 01915-6106

Publishers at Scrivener
Martin Scrivener ([email protected])
Phillip Carmical ([email protected])
Data Structure
and Algorithms Using C++

A Practical Implementation

Edited by
Sachi Nandan Mohanty
ICFAI Foundation For Higher Education, Hyderabad, India
and
Pabitra Kumar Tripathy
Kalam Institute of Technology, Berhampur, India
This edition first published 2021 by John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, USA
and Scrivener Publishing LLC, 100 Cummings Center, Suite 541J, Beverly, MA 01915, USA
© 2021 Scrivener Publishing LLC
For more information about Scrivener publications please visit www.scrivenerpublishing.com.

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or
transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or other-
wise, except as permitted by law. Advice on how to obtain permission to reuse material from this title
is available at http://www.wiley.com/go/permissions.

Wiley Global Headquarters


111 River Street, Hoboken, NJ 07030, USA

For details of our global editorial offices, customer services, and more information about Wiley prod-
ucts visit us at www.wiley.com.

Limit of Liability/Disclaimer of Warranty


While the publisher and authors have used their best efforts in preparing this work, they make no rep­
resentations or warranties with respect to the accuracy or completeness of the contents of this work and
specifically disclaim all warranties, including without limitation any implied warranties of merchant-­
ability or fitness for a particular purpose. No warranty may be created or extended by sales representa­
tives, written sales materials, or promotional statements for this work. The fact that an organization,
website, or product is referred to in this work as a citation and/or potential source of further informa­
tion does not mean that the publisher and authors endorse the information or services the organiza­
tion, website, or product may provide or recommendations it may make. This work is sold with the
understanding that the publisher is not engaged in rendering professional services. The advice and
strategies contained herein may not be suitable for your situation. You should consult with a specialist
where appropriate. Neither the publisher nor authors shall be liable for any loss of profit or any other
commercial damages, including but not limited to special, incidental, consequential, or other damages.
Further, readers should be aware that websites listed in this work may have changed or disappeared
between when this work was written and when it is read.

Library of Congress Cataloging-in-Publication Data

ISBN 978-1-119-75054-3

Cover image: Pixabay.Com


Cover design by Russell Richardson

Set in size of 11pt and Minion Pro by Manila Typesetting Company, Makati, Philippines

Printed in the USA

10 9 8 7 6 5 4 3 2 1
Contents

Preface xi
1 Introduction to Data Structure 1
1.1 Definition and Use of Data Structure 1
1.2 Types of Data Structure 2
1.3 Algorithm 3
1.4 Complexity of an Algorithm 6
1.5 Efficiency of an Algorithm 7
1.6 Asymptotic Notations 8
1.7 How to Determine Complexities 9
1.8 Questions 13
2 Review of Concepts of ‘C++’ 15
2.1 Array 15
2.1.1 One-Dimensional Array 16
2.1.2 Multi-Dimensional Array 17
2.1.3 String Handling 20
2.2 Function 26
2.2.1 User Defined Functions 26
2.2.2 Construction of a Function 27
2.2.3 Actual Argument and Formal Argument 31
2.2.4 Call by Value and Call by Reference 32
2.2.5 Default Values for Parameters 34
2.2.6 Storage Class Specifiers 35
2.3 Pointer 37
2.3.1 Declaration of a Pointer 37
2.3.2 Initialization of a Pointer 37
2.3.3 Arithmetic With Pointer 38
2.3.4 Passing of a Pointer to Function 39
2.3.5 Returning of a Pointer by Function 40
2.3.6 C++ Null Pointer 41

v
vi Contents

2.4 Structure 42
2.4.1 The typedef Keyword 46
2.5 Questions 47
3 Sparse Matrix 49
3.1 What is Sparse Matrix 49
3.2 Sparse Matrix Representations 49
3.3 Algorithm to Represent the Sparse Matrix 51
3.4 Programs Related to Sparse Matrix 52
3.5 Why to Use Sparse Matrix Instead of Simple Matrix? 56
3.6 Drawbacks of Sparse Matrix 57
3.7 Sparse Matrix and Machine Learning 57
3.8 Questions 58
4 Concepts of Class 59
4.1 Introduction to CLASS 59
4.2 Access Specifiers in C++ 60
4.3 Declaration of Class 60
4.4 Some Manipulator Used In C++ 62
4.5 Defining the Member Functions Outside of the Class 64
4.6 Array of Objects 64
4.7 Pointer to Object 66
4.8 Inline Member Function 67
4.9 Friend Function 69
4.9.1 Simple Friend Function 69
4.9.2 Friend With Inline Substitution 70
4.9.3 Granting Friendship to Another Class
(Friend Class) 71
4.9.4 More Than One Class Having the Same
Friend Function 73
4.10 Static Data Member and Member Functions 75
4.11 Constructor and Destructor 78
4.11.1 Constructor 78
4.11.1.1 Empty Constructor 79
4.11.1.2 Default Constructor 79
4.11.1.3 Parameterized Constructors 80
4.11.1.4 Copy Constructor 81
4.11.2 Destructor 83
4.12 Dynamic Memory Allocation 84
4.13 This Pointer 86
4.14 Class Within Class 87
4.15 Questions 89
Contents vii

5 Stack 91
5.1 STACK 91
5.2 Operations Performed With STACK 91
5.3 ALGORITHMS 93
5.4 Applications of STACK 96
5.5 Programming Implementations of STACK 106
5.6 Questions 126
6 Queue 129
6.1 Queue 129
6.2 Types of Queue 129
6.3 Linear Queue 129
6.4 Circular Queue 134
6.5 Double Ended Queue 138
6.6 Priority Queue 139
6.7 Programs 142
6.8 Questions 165
7 Linked List 167
7.1 Why Use Linked List? 167
7.2 Types of Link List 167
7.3 Single Link List 168
7.4 Programs Related to Single Linked List 177
7.4.1 /* Creation of a Linked List */ 177
7.4.2 /* Insert a Node Into a Simple Linked List at
the Beginning */ 178
7.4.3 /* Insert a Node Into a Simple Linked List at
the End of the List */ 180
7.4.4 /* Insert a Node Into a Simple Linked List
When the Node Is Known */ 182
7.4.5 /* Insert a Node Into a Simple Linked List
Information Is Known and Put After Some
Specified Node */ 184
7.4.6 /* Deleting the First Node From a Simple
Linked List */ 187
7.4.7 /* Deleting the Last Node From a Simple
Linked List */ 189
7.4.8 /* Deleting a Node From a Simple Linked
List When Node Number Is Known */ 191
7.4.9 Deleting a Node From a Simple Linked List
When Information of a Node Is Given 193
viii Contents

7.4.10 /* SEARCH A NODE INTO A SIMPLE LINKED


LIST WITH INFORMATION IS KNOWN*/ 197
7.4.11 /* Sorting a Linked List in Ascending Order */ 199
7.4.12 /* Reversing a Linked List */ 202
7.4.13 Program for Student Data Using Linked List 203
7.5 Double Link List 210
7.6 Programs on Double Linked List 216
7.6.1 /* Creation of Double Linked List */ 216
7.6.2 /* Inserting First Node in the Doubly
Linked List */ 218
7.6.3 /*Inserting a Node in the Doubly Linked List
When Node Number Is Known*/ 220
7.6.4 /*Inserting a Node in the Doubly Linked List
When Information Is Known*/ 223
7.6.5 /* Delete First Node From a Double Linked List */ 226
7.6.6 /*Delete the Last Node From the Double
Linked List*/ 229
7.7 Header Linked List 231
7.7.1 /* Inserting a Node Into a Header Linked List */ 233
7.8 Circular Linked List 235
7.9 Application of Linked List 239
7.9.1 Addition of Two Polynomial 239
7.9.2 /* Polynomial With Help of Linked List */ 240
7.9.3 Program for Linked Queue 241
7.9.4 Program for Linked Stack 243
7.10 Garbage Collection and Compaction 245
7.11 Questions 247
8 TREE 249
8.1 Tree Terminologies 249
8.2 Binary Tree 251
8.3 Representation of Binary Tree 253
8.3.1 Array Representation of a Tree 253
8.3.2 Linked List Representation of a Tree 254
8.4 Operations Performed With the Binary Tree 254
8.4.1 /*Creation of a Tree*/ 255
8.5 Traversing With Tree 256
8.5.1 /* Binary Tree Traversal */ 259
8.6 Conversion of a Tree From Inorder and Preorder 262
Contents ix

8.7 Types of Binary Tree 265


8.8 Expression Tree 265
8.9 Binary Search Tree 268
8.10 Height Balanced Tree (AVL Tree) 272
8.11 Threaded Binary Tree 277
8.12 Heap Tree 279
8.13 Huffman Tree 282
8.14 Decision Tree 286
8.15 B-Tree 287
8.16 B + Tree 292
8.17 General Tree 293
8.18 Red–Black Tree 293
8.19 Questions 294
9 Graph 295
9.1 Graph Terminologies 295
9.2 Representation of Graph 301
9.3 Traversal of Graph 305
9.3.1 Breadth First Search (BFS) 305
9.3.2 Depth First Search 311
9.4 Spanning Tree 315
9.4.1 Kruskal Algorithm 315
9.4.2 Prim’s Algorithm 318
9.5 Single Source Shortest Path 322
9.5.1 Bellman–Ford Algorithm 323
9.5.2 Dijkstra’s Algorithm 327
9.6 All Pair Shortest Path 335
9.7 Topological Sorting 345
9.8 Questions 347
10 Searching and Sorting 349
10.1 Linear Search 349
10.2 Binary Search 351
10.3 Bubble Sort 355
10.4 Selection Sort 359
10.5 Insertion Sort 361
10.6 Merge Sort 363
10.7 Quick Sort 366
10.8 Radix Sort 369
10.9 Heap Sort 372
10.10 Questions 389
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
x Contents

11 Hashing 391
11.1 Hash Functions 391
11.2 Collisions 393
11.3 Collision Resolution Methods 393
11.4 Clustering 394
11.5 Questions 395
Index 397
Preface

Welcome to the first edition of Data Structures and Algorithms Using C++.
A data structure is the logical or mathematical arrangement of data in
memory. To be effective, data has to be organized in a manner that adds to
the efficiency of an algorithm and also describe the relationships between
these data items and the operations that can be performed on these items.
The choice of appropriate data structures and algorithms forms the funda-
mental step in the design of an efficient program. Thus, a deep understand-
ing of data structure concepts is essential for students who wish to work
on the design and implementation of system software written in C++, an
object-oriented programming language that has gained popularity in both
academia and industry. Therefore, this book was developed to provide
comprehensive and logical coverage of data structures like stacks, queues,
linked lists, trees and graphs, which makes it an excellent choice for learn-
ing data structures. The objective of the book is to introduce the concepts
of data structures and apply these concepts in real-life problem solving.
Most of the examples presented resulted from student interaction in the
classroom. This book utilizes a systematic approach wherein the design of
each of the data structures is followed by algorithms of different operations
that can be performed on them and the analysis of these algorithms in
terms of their running times.
This book was designed to serve as a textbook for undergraduate engi-
neering students across all disciplines and postgraduate level courses in
computer applications. Young researchers working on efficient data storage
and related applications will also find it to be a helpful reference source to
guide them in the newly established techniques of this rapidly growing
research field.

Dr. Sachi Nandan Mohanty and


Prof. Pabitra Kumar Tripathy
December 2020

xi
1
Introduction to Data Structure

1.1 Definition and Use of Data Structure


Data structure is the representation of the logical relationship existing
between individual elements of data. In other words the data structure is a
way of organizing all data items that considers not only the elements stored
but also their relationship to each other.
Data structure specifies

• Organization of data
• Accessing methods
• Degree of associativity
• Processing alternatives for information

The data structures are the building blocks of a program and hence the
selection of a particular data structure stresses on

• The data structures must be rich enough in structure to


reflect the relationship existing between the data, and
• The structure should be simple so that we can process data
effectively whenever required.

In mathematically Algorithm + Data Structure = Program


Finally we can also define the data structure as the “Logical and mathe-
matical model of a particular organization of data”

Sachi Nandan Mohanty and Pabitra Kumar Tripathy. Data Structure and Algorithms Using C++:
A Practical Implementation, (1–14) © 2021 Scrivener Publishing LLC

1
2 Data Structure and Algorithms Using C++

1.2 Types of Data Structure


Data structure can be broadly classified into two categories as Linear and
Non-Linear

DATA STRUCTURE

LINEAR NON LINEAR

ARRAY QUEUE STACK TREE GRAPH TABLES SETS

Linear Data Structures


In linear data structures, values are arranged in linear fashion. Arrays,
linked lists, stacks, and queues are the examples of linear data structures in
which values are stored in a sequence.

Non-Linear Data Structure


This type is opposite to linear. The data values in this structure are not
arranged in order. Tree, graph, table, and sets are the examples of non-
linear data structure.

Operations Performed in Data Structure


In data structure we can perform the operations like

• Traversing
• Insertion
• Deletion
• Merging
• Sorting
• Searching
Introduction to Data Structure 3

1.3 Algorithm
The step by step procedure to solve a problem is known as the ALGORITHM.
An algorithm is a well-organized, pre-arranged, and defined computational
module that receives some values or set of values as input and provides a
single or set of values as out put. These well-defined computational steps
are arranged in sequence, which processes the given input into output.
An algorithm is said to be accurate and truthful only when it provides
the exact wanted output.
The efficiency of an algorithm depends on the time and space complex-
ities. The complexity of an algorithm is the function which gives the run-
ning time and/or space in terms of the input size.

Steps Required to Develop an Algorithm


• Finding a method for solving a problem. Every step of an
algorithm should be defined in a precise and in a clear man-
ner. Pseudo code is also used to describe an algorithm.
• The next step is to validate the algorithm. This step includes
all the steps in our algorithm and should be done manually
by giving the required input, perform the required steps
including in our algorithm and should get the required
amount of output in a finite amount of time.
• Finally implement the algorithm in terms of programming
language.

Mathematical Notations and Functions


™™ Floor and Ceiling Functions
Floor function returns the greatest integer that does not exceed
the number.
Ceiling function returns the least integer that is not less than
the number.

no denotes the floor function

no denotes the ceil function

Ex :
5.23 = 5 5.23 =6
4 Data Structure and Algorithms Using C++

™™ Remainder Function
To find the remainder “mod” function is being used as

A mod B

™™ To find the Integer and Absolute value of a number


INT(5.34) = 5 This statement returns the integer part of
the number
INT(- 6.45) = 6 This statement returns the absolute as well
as the integer portion of the number

™™ Summation Symbol
To add a series of number as a1+ a2 + a3 +…………+ an the
symbol Σ is used

n
Σ ai
i=1

™™ Factorial of a Number
The product of the positive integers from 1 to n is known as
the factorial of n and it is denoted as n!.

0! = 1

Algorithemic Notations
While writing the algorithm the comments are provided with in [ ].
The assignment should use the symbol “: =” instead of “=”
For Input use Read : variable name
For output use write : message/variable name

The control structures can also be allowed to use inside an algorithm but
their way of approaching will be some what different as
Simple If
If condition, then:
Statements
[end of if structure]
Introduction to Data Structure 5

If…else
If condition, then:
Statements
Else :
Statements
[end of if structure]

If…else ladder
If condition1, then:
Statements
Else If condition2, then:
Statements
Else If condition3, then:
Statements
…………………………………………

…………………………………………

…………………………………………
Else If conditionN, then:
Statements
Else:
Statements
[end of if structure]

LOOPING CONSTRUCT
Repeat for var = start_value to end_value by
step_value
Statements
[end of loop]

Repeat while condition:


Statements
[end of loop]
Ex : repeat for I = 1 to 10 by 2
Write: i
[end of loop]

OUTPUT
1 3 5 7 9
6 Data Structure and Algorithms Using C++

1.4 Complexity of an Algorithm


The complexity of programs can be judged by criteria such as whether
it satisfies the original specification task, whether the code is readable.
These factors affect the computing time and storage requirement of the
program.

Space Complexity
The space complexity of a program is the amount of memory it needs to
run to completion. The space needed by a program is the sum of the fol-
lowing components:

• A fixed part that includes space for the code, space for sim-
ple variables and fixed size component variables, space for
constants, etc.
• A variable part that consists of the space needed by com-
ponent variables whose size is dependent on the particular
problem instance being solved, and the stack space used by
recursive procedures.

Time Complexity
The time complexity of a program is the amount of computer time it needs
to run to completion. The time complexity is of two types such as

• Compilation time
• Runtime

The amount of time taken by the compiler to compile an algorithm is


known as compilation time. During compilation time it does not calculate
for the executable statements, it calculates only the declaration statements
and checks for any syntax and semantic errors.
The run time depends on the size of an algorithm. If the number of
instructions in an algorithm is large, then the run time is also large, and if
the number of instructions in an algorithm is small, then the time for exe-
cuting the program is also small. The runtime is calculated for executable
statements and not for declaration statements.
Introduction to Data Structure 7

Suppose space is fixed for one algorithm then only run time will be con-
sidered for obtaining the complexity of algorithm, these are

• Best case
• Worst case
• Average case

Best Case
Generally, most of the algorithms behave sometimes in best case. In this
case, algorithm searches the element for the first time by itself.
For example: In linear search, if it finds the element for the first time by
itself, then it behaves as the best case. Best case takes shortest time to exe-
cute, as it causes the algorithms to do the least amount of work.

Worst Case
In worst case, we find the element at the end or when searching of elements
fails. This could involve comparing the key to each list value for a total of
N comparisons.
For example in linear search suppose the element for which algorithm
is searching is the last element of array or it is not available in array then
algorithm behaves as worst case.

Average Case
Analyzing the average case behavior algorithm is a little bit complex than
the best case and worst case. Here, we take the probability with a list of
data. Average case of algorithm should be the average number of steps but
since data can be at any place, so finding exact behavior of algorithm is
difficult. As the volume of data increases, the average case of algorithm
behaves like the worst case of algorithm.

1.5 Efficiency of an Algorithm


Efficiency of an algorithm can be determined by measuring the time, space,
and amount of resources it uses for executing the program. The amount of
time taken by an algorithm can be calculated by finding the number of
steps the algorithm executes, while the space refers to the number of units
it requires for memory storage.
8 Data Structure and Algorithms Using C++

1.6 Asymptotic Notations


The asymptotic notations are the symbols which are used to solve the dif-
ferent algorithms and the notations are

• Big Oh Notation (O)


• Little Oh Notation (o)
• Omega Notation (W)
• Theta Notation (q)

Big Oh (O) Notation


This Notation gives the upper bound for a function to within a constant
factor. We write f(n) = O(g(n)) if there are +ve constants n0 and C such
that to the right of n0, the value of f(n) always lies on or below Cg(n)

Omega Notation (W)


This notation gives a lower bound for a function to with in a constant fac-
tor. We write f(n) = Ωg(n) if there are positive constants n0 and C such that
to the right of n0 the value of f(n) always lies on or above Cg(n)

Theta Notation (q)


This notation bounds the function to within constant factors. We say f(n) =
θg(n) if there exists +ve constants n0, C1 and C2 such that to the right of n0
the value of f(n) always lies between c1g(n) and c2(g(n)) inclusive.

Little Oh Notation (o)


F(n) = o(g(n)) iff f(n) = O(g(n)) and f(n) != Ωg(n).

Introduction
An important question is: How efficient is an algorithm or piece of code?
Efficiency covers lots of resources, including:
CPU (time) usage
Memory usage
Disk usage
Network usage
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Introduction to Data Structure 9

All are important but we will mostly talk about CPU time
Be careful to differentiate between:

Performance: how much time/memory/disk/... is actually used


when a program is running. This depends on the machine, compiler, etc.,
as well as the code.

Complexity: how do the resource requirements of a program or algorithm


scale, i.e., what happens as the size of the problem being solved gets larger.
Complexity affects performance but not the other way around. The time
required by a method is proportional to the number of “basic operations”
that it performs. Here are some examples of basic operations:
one arithmetic operation (e.g., +, *).
one assignment
one test (e.g., x == 0)
one read
one write (of a primitive type)

Note: As an example,
O(1) refers to constant time.
O(n) indicates linear time;
O(nk) (k fixed) refers to polynomial time;
O(log n) is called logarithmic time;
O(2n) refers to exponential time, etc.
n² + 3n + 4 is O(n²), since n² + 3n + 4 < 2n² for all n > 10. Strictly speaking,
3n + 4 is O(n²), too, but big-O notation is often misused to mean equal to
rather than less than.

1.7 How to Determine Complexities


In general, how can you determine the running time of a piece of code?
The answer is that it depends on what kinds of statements are used.

1. Sequence of statements
statement 1;
statement 2;
...
statement k;
10 Data Structure and Algorithms Using C++

Note: this is code that really is exactly k statements; this is not


an unrolled loop like the N calls to addBefore shown above.)
The total time is found by adding the times for all statements:

total time = time(statement 1) + time


(statement 2) + ... + time(statement k)

If each statement is “simple” (only involves basic opera-


tions) then the time for each statement is constant and the
total time is also constant: O(1). In the following examples,
assume the statements are simple unless noted otherwise.
2. if-then-else statements
if (cond) {
sequence of statements 1
}
else {
sequence of statements 2
}

Here, either sequence 1 will execute, or sequence 2 will execute.


Therefore, the worst-case time is the slowest of the two possi-
bilities: max(time(sequence 1), time(sequence 2)). For exam-
ple, if sequence 1 is O(N) and sequence 2 is O(1) the worst-case
time for the whole if-then-else statement would be O(N).
3. for loops
for (i = 0; i < N; i++) {
sequence of statements
}

The loop executes N times, so the sequence of statements also


executes N times. Since we assume the statements are O(1), the
total time for the for loop is N * O(1), which is O(N) overall.
4. Nested loops
for (i = 0; i < N; i++) {
for (j = 0; j < M; j++) {
sequence of statements
}
}

The outer loop executes N times. Every time the outer loop
executes, the inner loop executes M times. As a result, the
statements in the inner loop execute a total of N * M times.
Thus, the complexity is O(N * M). In a common special case
Introduction to Data Structure 11

where the stopping condition of the inner loop is j < N


instead of j < M (i.e., the inner loop also executes N times),
the total complexity for the two loops is O(N2).
5. Statements with method calls:
When a statement involves a method call, the complexity of
the statement includes the complexity of the method call.
Assume that you know that method f takes constant time,
and that method g takes time proportional to (linear in) the
value of its parameter k. Then the statements below have the
time complexities indicated.
f(k); // O(1)
g(k); // O(k)

When a loop is involved, the same rule applies. For example:


for (j = 0; j < N; j++) g(N);

has complexity (N2). The loop executes N times and each


method call g(N) is complexity O(N).

Examples
Q1. What is the worst-case complexity of the each of the following code
fragments?

Two loops in a row:


for (i = 0; i < N; i++) {
sequence of statements
}
for (j = 0; j < M; j++) {
sequence of statements
}

Answer: Th
 e first loop is O(N) and the second loop is O(M). Since you
do not know which is bigger, you say this is O(N+M). This can
also be written as O(max(N,M)). In the case where the second
loop goes to N instead of M the complexity is O(N). You can
see this from either expression above. O(N+M) becomes O(2N)
and when you drop the constant it is O(N). O(max(N,M))
becomes O(max(N,N)) which is O(N).
12 Data Structure and Algorithms Using C++

Q2. How would the complexity change if the second loop went to N
instead of M?
A nested loop followed by a non-nested loop:
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
sequence of statements
}
}
for (k = 0; k < N; k++) {
sequence of statements
}

Answer: Th
 e first set of nested loops is O(N2) and the second loop is
O(N). This is O(max(N2,N)) which is O(N2).
Q3. A nested loop in which the number of times the inner loop executes
depends on the value of the outer loop index:
for (i = 0; i < N; i++) {
for (j = i; j < N; j++) {
sequence of statements
}
}

Answer: W
 hen i is 0 the inner loop executes N times. When i is 1 the
inner loop executes N-1 times. In the last iteration of the outer
loop when i is N-1 the inner loop executes 1 time. The number
of times the inner loop statements execute is N + N-1 + ... + 2 +
1. This sum is N(N+1)/2 and gives O(N2).
Q4. For each of the following loops with a method call, determine the
overall complexity. As above, assume that method f takes constant time,
and that method g takes time linear in the value of its parameter.

a. for (j = 0; j < N; j++) f(j);


b. for (j = 0; j < N; j++) g(j);
c. for (j = 0; j < N; j++) g(k);

Answer: a. E
 ach call to f(j) is O(1). The loop executes N times so it is N x
O(1) or O(N).
b. The first time the loop executes j is 0 and g(0) takes “no oper-
ations.” The next time j is 1 and g(1) takes 1 operations. The
last time the loop executes j is N-1 and g(N-1) takes N-1 oper-
ations. The total work is the sum of the first N-1 numbers and
is O(N2).
Introduction to Data Structure 13

c. Each time through the loop g(k) takes k operations and the
loop executes N times. Since you do not know the relative size
of k and N, the overall complexity is O(N x k).

1.8 Questions
1. What is data structure?
2. What are the types of operations that can be performed with
data structure?
3. What is asymptotic notation and why is this used?
4. What is complexity and its type?
5. Find the complexity of 3n2 + 5n.
6. Distinguish between linear and non-linear data structure.
7. Is it necessary is use data structure in every field? Justify
your answer.
Random documents with unrelated
content Scribd suggests to you:
The conventionalized Roman busts with the Greek lettering were so
top-heavy in appearance that I grew quite dizzy....
I found relief in the sculptor of the Ancient Greeks,—peace in the
simplicity of a strange inspired beauty that intricate handling which
draws on past glories can never produce.
C. A. Z.
Fairy-Tale Mysticism
Jerusalem, a Novel by Selma Lagerlöf (Doubleday, Page & Co., New York).

T hose Scandinavians! I have often wondered at the combination


of grim strength with childlike imaginativeness that we find in
the artists of those pale cold lands. In the winter, at twilight, I
like to sit with closed eyes and to relive old and new Norse sagas,
the unbelievable wonders told or sung or painted with the perfect
earnestness of absorbed children; I like to dream then to the
accompaniment of the not-smiling music of the sad child, Edward
Grieg.
Jerusalem is not a novel, not according to the terminology
accepted heretofore. For—may I reveal a secret en passant?—we are
on the eve of the publication of a novel by a Chicagoan who will
revolutionize the prevailing literary classifications. Another thing
which is not! Selma Lagerlöf is not a mystic, some of her friends
want us to believe; not in the Maeterlinckian sense. The book is a
series of tapestries to be hung in an ideal children’s-room; a web of
fairy-tales told in the Scandinavian, unsmiling, earnest way. Mystic?
Yes, as much as all fairy-tales are mystic, as much as all not “clever”
and “wonderful” children are mystic. A mysticism which instead of
lifting us up to the clouds brings the clouds down to us; instead of
lending us wings and making us soar in imperceptible intangible
regions, anthropomorphosizes gods and spirits and drags them down
to terra firma. So convincing! We actually see the dead Ingmarssons
gathered in a large farm house up in heaven; we see their ruddy
hard faces, sandy hair, white eyes; we hear their slow, heavy, laconic
talk. We are not surprised at meeting Christ among the pines in the
glow of the autumnal sunset. The opening of heaven on a winter
night before the eyes of the two Ingomars appears as ordinary
reality. We are in a world where everything is simple, believable,
possible. And you cannot smile; you are in an earnest childlike
atmosphere.
Those Scandinavians!
K.
The Reader Critic

UNWORTHY!
Rev. W. D. J., Riverside, Ill.:
I used to have great expectations for you. But, pardon the
frankness of one who has watched the careers of many writers in
the past fifty years, you are headed now either for the lake or a
padded cell. God forbid you reach either. Let an old man say that the
only way to find life is to lose it. Forget it and reach out a hand to
the poor, the sick, the suffering, and the sinning. Happiness comes
only in forgetfulness of self and ministering to others. It is never the
result of a theory but of action. I have seen so many wrecked on the
reefs toward which you are drifting that I am fain to call out and
entreat you to find happiness where alone it can be found, not in
fleeing from the world or cursing it but in thanking God you were
born into a world where you can be of some use to your fellows.
Those lines of yours in the September issue might have been written
by a Heine, a Byron, or a Walt Whitman. But they are unworthy of
you. You were born to bless your fellows. Be true to your vocation.

AN EXAMPLE!
R. C. Smith, Chicago:
Inspiration will never take the place of intelligence, nor
enthusiasm that of cerebration. Your magazine will die,—as a steam
engine would grow useless in which no direction toward any cylinder
was given to the indubitable forces generated in the boiler. For your
pages are as a rule careless, unconsidered, and inept. Let me give
you an example:—
Mr. Huntley Carter, in your September number, wrote on “Poetry
versus Imagism.” I happen to consider his article an ill-digested
congeries of vague views; but other persons may feel differently
about it. What, however, can be the estimation in which every sane
and intelligent and decently responsible man will hold your magazine
and Mr. Carter when he has the effrontery to present to us such an
example of ineptitude and carelessness as this:—
“Browning ... gets to work in a businesslike manner:

The sun looked over the water’s brim


And straight there was a path of gold for him
And a world of souls for me.

I QUOTE FROM MEMORY, BUT I BELIEVE I QUOTE CORRECTLY.”


(The capitals are mine.)
May I ask—must an enthusiasm for or against the new movements
obliterate all sense of accuracy, all love of clear and rational
communication, all fidelity to honest statement, and all interest in
truth? Your Mr. Carter and his extraordinary indifference to the
workaday obligations of literary criticism have considerably
discouraged my interest in the new forces. I can imagine Mr. Carter
writing—“Since, as Nansen says, ‘The natives of the polar regions
are coal-black,’—(I quote from memory), it must be hotter there
than at the equator.”
You have printed many encomiums of your magazine: I shall
watch with curiosity to see if you print this.

THE WEAKNESS OF REVOLT


Dr. Weil, New York:
The spirit of revolt is compounded from many causes. Even in the
average young girl of whom Mr. Hecht writes in the August Little
Review it arises as much from her digestion as from her incomplete
physical functioning, as much from her work as from her leisure, as
much from her friends as from her freshness. Mr. Hecht would be
the first to admit that; would he be equally willing to admit that it
meets death variously?
He talks only of the family as the snuffer for the flame. This does
not mean that he excludes other causes, but it does mean that he
has overemphasized one.
It is true, as Mr. Hecht insists, that the American family tends to
quell revolt. The battle of the generations is as old as the race; the
family has always struggled to bring the rebel into line for its own
preservation. But that struggle in all its various shades of acuteness
has become a truism of modern thought, thanks to a multiplex
modern drama, a scientific sociology, and even the daily press. Why
discuss the subject only to dwell again heavily on the obvious?
The problem is far more complicated. The verdict of guilt against
the family grows monotonous when returned at every inquest. To
place a single responsible cause for any tremor to revolt that dies
abortive is to lack subtlety.
Along with each verdict against the family there is also a verdict
against the individual. One is not to blame if she is not a genius, but
if even her greatest emotions are somewhat lacking in poignancy,
the fluctuating spirit of restlessness in her never reaches the heights
which demand action.
Along with each verdict against the family there is also a verdict
against the quality of the revolutionary spirit. Not only are its causal
factors weak and fluctuating, but the very vagueness which to Mr.
Hecht constitutes its charm spells also its damnation. A spirit of
restlessness is, in itself, nothing about which one can go to the
hilltops and shout, and when it crystalizes in some particular issue,—
a book, a picture, a small individual right,—the object often seems
too trivial to struggle for. To be sure the principle is not a small
thing, but a principle is abstract and when it confronts a concrete bit
of suffering, it fades by contrast.
The sordid bread and butter difficulties to be faced by one
standing wholly alone, the scathing force of public opinion, the pain
of others which, when you love them, is pain to you,—these are
realities which only the truly big souls dare to face. For most of us
the spirit of revolt is too diffuse even to demand action, and for most
of the rest action is too divine a consummation to be compassed by
our weak human spirit. Not to any external cause really, but to an
inherent lack in us, is it due that we slowly grow complacent, instead
of crusading worthily in behalf of liberty.

Alice Groff, Philadelphia:


The most of you publishers are such unspeakable Kaisers of Kultur
that you treat the geniuses who make you what you are as
insignificant privates in a literary army, which you deploy; keeping
them dangling upon your critical pleasure, or blowing them to pieces
because they do not happen to walk the line you mark out.
I suppose this is inevitable, however, in the present social order
and that there will never be free literary expression until there is
publishing organization on the part of the whole people for the
benefit of the whole people. May the universe speed the day of such
organization.
Have You Read—?
(In this column will be given each month a list of current magazine articles which,
as an intelligent being, you will not want to miss.)

Gaudier-Brzeska’s Art, by John Caurnos. The Egoist, September 1.


Havelock Ellis on Birth Control in Physical Culture for September,
October, November.
The Literature of a Moral Republic, by H. L. Mencken. The Smart Set,
October.
The Undergraduate. The New Republic, September 25.
Can You Read—?
(In this column will be given each month a resume of current cant which, as an
intelligent being, you may wish to be diverted or angered or stimulated by.)

International Duty and Hyphenated Americans, by Theodore


Roosevelt. The Metropolitan, October.
In Memory of Lieutenant Rupert Brooke, by Joyce Kilmer. The
Bookman, September.
Llewellyn Jones on New Tendencies in the Arts, in any issue of The
Chicago Evening Post Friday Review.
THE EGOIST
An Individualist Review

Subscribe to THE EGOIST and hear what you will get:


Editorials containing the most notable creative and critical philosophic matter
appearing in England today.
Some of the newest and best experimental English and American poetry.
A page of current French poetry.
Reviews of only those books which are worth praise.
News of modern music, of new painting, of French literary and artistic life.
A series of translations of Greek and Latin poetry and prose, done by young
modern poets (began September 1st, 1915).

PUBLISHED MONTHLY
Price—Fifteen cents a number
Yearly subscription, One Dollar Sixty Cents

Buy some of the back numbers. They are literature, not journalism.

OAKLEY HOUSE, BLOOMSBURY STREET, LONDON, W. C.


Sleep Outdoors All Winter with the
Hold-Heet Health Blanket
Reserve Force—health—virility of mind and
body—clear eyes—brain power—these are
considerations, aren’t they? Keep them up to
100% by cashing in on Nature’s richest offering
—FRESH AIR.
The Hold-Heet Health Blanket solves the
problem of outdoor winter sleeping. Endorsed
and used by over three thousand eminent
authorities, doctors, lawyers, bankers, business
men. It makes the modern fresh air bed room
far more comfortable than the old stuffy one
and a thousand times more healthful.
Built the same and is, in many respects, like a
regular blanket. Specially wound, protected
asbestos covered heating element distributes an
even degree of heat to every part of the
blanket. Connected with the nearest lamp
socket—consumes about 1c worth of current a
night. Equipped with 3-heat control—cannot
overheat. Very light, soft and flexible and
weighs less than half as much as the ordinary
comforter. Covered with a beautiful soft, navy
blue sateen. Complete in leatherette case.
Delivered prepaid at the following prices:—
Size 36×36 inches, 3-heat Special $10.00
Infants’
Size 36×72 inches, 3-heat Single 14.00
Width
Size 54×72 inches, 3-heat Double 20.00
Width
Obey that impulse—NOW. It’s the cheapest
health insurance you can buy. Every Hold-Heet
Blanket is guaranteed for two years. They last a
life time. Send your order now—and get winter
health and comfort.
National Electric Company, Chicago, U. S. A.
A group is being formed for the study of Russian language.
A group is being formed for the study of Russian literature.
For information inquire at the

Little Review
834 Fine Arts Building

EMMA GOLDMAN

will lecture at

The Fine Arts Theatre

from Nov. 21 to Dec. 5


Subjects to be announced later. All information may be had at the office of
The Little Review, 834 Fine Arts Building, Chicago.

Tchai-na-ya

Russian Tea Room

Luncheons, Dinners
Afternoon Tea

116 S. Michigan Blvd. R. 300, Lake View Bldg.

Russian Art Store

Peasant Handicraft
Linens, Laces
Antique Jewelry
730 Sheridan Rd. M. R. POLAKOPF & SON
Statement of Ownership, Management, Circulation, Etc., required
by the Act of August 24, 1912
of THE LITTLE REVIEW published monthly at Chicago, Ill. for Oct. 1st, 1915.
Editor, Margaret C. Anderson, 834 Fine Arts Building, Chicago Managing
Editor, Same Business Manager, Same Publisher, Same
Owners: (If a corporation, give its name and the names and addresses of
stockholders holding 1 per cent or more of total amount of stock. If not a
corporation, give names and addresses of individual owners.)
Margaret C. Anderson
834 Fine Arts Building, Chicago
Known bondholders, mortgagees, and other security holders, holding 1 per
cent or more of total amount of bonds, mortgages, or other securities: None
MARGARET C. ANDERSON,
Sworn to and subscribed before me this 23rd day of Sept., 1915.
MITCHELL DAWSON, Notary Public.
(My commission expires December 20, 1917.)
THE DRAMA
for August Contained This Interesting Material

A LETTER CONCERNING AUGIER, by Eugene Brieux 353


THE MARRIAGE OF OLYMPE, by Emile Augier 358
EMILE AUGIER, by Barrett Clark 440
PARSEE DRAMA, by George Cecil 459
THE EVOLUTION OF THE ACTOR, by Arthur Pollock 468
FRANK WEDEKIND, by Frances Fay 479
DEPERSONALIZING THE INSTRUMENTS OF THE DRAMA, by Huntley 495
Carter
JAMES SHIRLEY, DRAMATIST, a review by Charlton Andrews 506
PLAYING HAMLET AS SHAKESPEARE STAGED IT IN 1601, by Charlotte 511
Porter
CHIEF CONTEMPORARY DRAMATISTS, a review by Alfred K. Eddy 527
THE SHAKESPEARE TERCENTENARY, Percival Chubb 531
RECENT MAGAZINE ARTICLES ON THE DRAMA 537
A SELECTIVE LIST OF ESSAYS AND BOOKS ABOUT THE THEATRE AND OF 538
PLAYS published during the second quarter of 1915, compiled by
Frank Chouteau Brown

The Drama for November will be a notable number. Rabindranath Tagore will
contribute an article on the stage that crystallizes much of the present diverse
generalization, especially in discussions of stagecraft. Julius Brouta, perhaps the
most celebrated drama critic of Spain, will write of the work of Benavente, a
brilliant Spanish playwright of today. A puppet play of Benavente, the popular
Los Interessos Creados, will be printed in its entirety. The New Stage Art in its
Relation to Drama will be considered from a new point of view by Alice Corbin
Henderson. The articles begun in the present number, Playing Hamlet as
Shakespeare Staged It in 1601, by Charlotte Porter, and The Evolution of the
Actor, by Arthur Pollock, will be concluded.
In November also will appear what promises to be one of the most important
pieces of dramatic poetry ever written in America, Edwin Arlington Robinson’s
Ben Jonson Entertains a Man from Stratford. In beauty of verse, in poetic vision,
and in its appreciation of the fine human quality of Shakespeare the poem is a
leading feature of the Shakespeare Tercentenary Celebration.
The Drama, a Quarterly 736 Marquette Building Chicago
$3.00 per year
THE
SEXUAL
QUESTION
Heretofore sold by subscription, only to physicians. Now offered to the public.
Written in plain terms. Former price $5.50. Now sent prepaid for $1.60. This is
the revised and enlarged Marshall English translation. Send check, money order
or stamps.

Ignorance Is the Great Curse!

Do you know, for instance, the scientific difference between love and passion?
Human life is full of hideous exhibits of wretchedness due to ignorance of sexual
normality.
Stupid, pernicious prudery long has blinded us to sexual truth. Science was slow
in entering this vital field. In recent years commercialists eyeing profits have
unloaded many unscientific and dangerous sex books. Now the world’s great
scientific minds are dealing with this subject upon which human happiness often
depends. No longer is the subject tabooed among intelligent people.
We take pleasure in offering to the American public, the work of one
of the world’s greatest authorities upon the question of sexual life. He
is August Forel, M.D., Ph.D., LL.D., of Zurich, Switzerland. His book will
open your eyes to yourself and explain many mysteries. You will be
better for this knowledge.
Every professional man and woman, those dealing with social, medical, criminal,
legal, religious and educational matters will find this book of immediate value.
Nurses, police officials, heads of public institutions, writers, judges, clergymen
and teachers are urged to get this book at once.
The subject is treated from every point of view. The chapter on “love and other
irradiations of the sexual appetite” is a profound exposition of sex emotions—
Contraceptive means discussed—Degeneracy exposed—A guide to all in
domestic relations—A great book by a great man.

GOTHAM BOOK SOCIETY, DEPT. 564.


General dealers in books, sent on mail order.
142 W. 23d St., New York City.
In answering this advertisement mention The Little Review.
DAVID HOCHSTEIN

Violin Recital

FINE ARTS THEATRE


410 S. Michigan Blvd.
SUNDAY AFTERNOON
December 5
Program to be Announced Later

Books to Rent and Sell

All the latest fiction available as soon as published at moderate rental fee.
Most efficient and satisfactory book renting service in Chicago.
Those wishing to purchase new or second hand books are invited to send
us their want lists. Quotations submitted before purchases are made. We
can save you money. Send for catalog.

Venetian Library and Book Shop


215 VENETIAN BLDG.
15 E. WASHINGTON ST. CHICAGO
Opp. Marshall Field’s
FINE ARTS THEATRE

For TWO WEEKS, Beginning


January 17, 1916

TWO PRODUCTIONS
by
THE CHICAGO PLAYERS
with
MME. BORGNY HAMMER

EVENINGS
“AGNETE”
by
AMALIE SKRAM
(First Time in English)

SPECIAL MATINEES
“THERESE RAQUIN”
by
EMILE ZOLA
Prices 25c to $1.50

CLARENCE THOMAS
Manager
925 Fine Arts Building

FINE ARTS THEATRE


The Song of the Lark

By WILLA SIBERT CATHER

The story of a prima donna’s career. “A story of something better than


suggestiveness and charm—a thing finished, sound and noble.”—The Nation.
“A distinct improvement on her previous novels, ‘O Pioneers,’ and ‘Alexander’s
Bridge.’”—New York Herald. $1.40 net.

David Penstephen

By RICHARD PRYCE

David is the most lovable of all the author’s creations, a boy who grew to
manhood under conditions that might have warped a soul less noble. $1.35 net.

The Little Book of American Poets

Edited by JESSIE B. RITTENHOUSE

This book, a companion volume to “The Little Book of Modern Verse,” gives a
bird’s-eye view of the 19th century, beginning with Philip Freneau and ending
with the period of Madison Cawein, Bliss Carman and Richard Hovey. 140 poets
are represented and the book includes 230 poems. Cloth, $1.25 net; limp
leather, $1.75 net.

The Log of a Noncombatant

By HORACE GREEN

An absorbing narrative of the adventures and experiences of an American


correspondent and dispatch bearer who saw fighting both with the Germans
and Allies and who, as messenger for the American Embassy at Berlin, had
exceptional opportunities for a glimpse behind the scenes in war-time Germany.
Illustrated. $1.25 net.

The Greatest of Literary Problems


By JAMES PHINNEY BAXTER

This work meets a long-felt need for a complete presentation of the Bacon-
Shakespeare question, and will prove as useful to students of Shakespeare as of
Bacon. It presents an exhaustive review of Shakespearean authors from Rowe
to Lee, as well as a bibliography covering all printed works upon the subject in
English, French, German, Spanish, Scandinavian, Italian, and Russian, articles in
periodical literature, and a wealth of illustrations of great value to students and
collectors. Illustrated. 8vo. $5.00.

Red Wine of Roussillon

By WILLIAM LINDSEY

“A really good romantic drama, one of the best that has been produced in a
generation.... Compact and well made, developing swiftly and logically a tragic
love story of uncommon interest.... Genuinely poetic.... A remarkable work,
both in the literary and dramatic sense.”—The Nation. $1.25 net.

Affirmations

By HAVELOCK ELLIS

A discussion of some of the fundamental questions of life and morality as


expressed in, or suggested by, literature. The subjects of the first five studies
are Nietzsche, Zola, Huysmans, Casanova and St. Francis of Assisi. $1.75 net.

The New Poetry Series

This series aims to produce artistic and inexpensive editions of representative


contemporary verse.
The new volumes added this fall are:—
Stillwater Pastorals and Other Poems

By Paul Shivell. With a Preface by Bliss Perry.

The Cloister: A Verse Drama

By Emile Verhaeren.

Interflow

By Geoffrey C. Faber.

Afternoons of April

By Grace Hazard Conkling.


Each, boards, 75 cents net

4 Park St. 16 E. 40th St.


Houghton Mifflin Co.
Boston New York
Transcriber’s Notes

Advertisements were collected at the end of the text.

The table of contents on the title page was adjusted in order to


reflect correctly the headings in this issue of The Little Review.

The original spelling was mostly preserved. A few obvious


typographical errors were silently corrected. All other changes are
shown here (before/after):

... me from the golden toombs of youth, from the scarlet graves of
love, I will ...
... me from the golden tombs of youth, from the scarlet graves of
love, I will ...
... under the distinction of being a maniacle sensualist, a libidinous
ruffian, a ...
... under the distinction of being a maniacal sensualist, a libidinous
ruffian, a ...
... “Peddlars are not allowed on the grounds. He must have
sneaked in.” ...
... “Peddlers are not allowed on the grounds. He must have
sneaked in.” ...
... my countrymen the value to them of Memoiren einer Idealisten.
...
... my countrymen the value to them of Memoiren einer Idealistin.
...
... Grune Heinrich.... I have lived more intensely with Jean
Christophe ...
... Grüne Heinrich.... I have lived more intensely with Jean
Christophe ...
... faced a Herculian task. The government was confronted with a
double ...
... faced a Herculean task. The government was confronted with a
double ...
... the verdict over the imbecile Czar and will cleanse the Aagean
...
... the verdict over the imbecile Czar and will cleanse the Augean
...
*** END OF THE PROJECT GUTENBERG EBOOK THE LITTLE
REVIEW, OCTOBER 1915 (VOL. 2, NO. 7) ***

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

You might also like