0% found this document useful (0 votes)
20 views

Data Structures With C Programming 2nd Edition Anil Kumar Yadav pdf download

Ebook

Uploaded by

goelffeabhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Data Structures With C Programming 2nd Edition Anil Kumar Yadav pdf download

Ebook

Uploaded by

goelffeabhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 80

Data Structures With C Programming 2nd Edition

Anil Kumar Yadav download

https://ebookbell.com/product/data-structures-with-c-
programming-2nd-edition-anil-kumar-yadav-55547078

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Data Structures With C Programming Yadav Anil Kumar Yadav Vinod Kumar

https://ebookbell.com/product/data-structures-with-c-programming-
yadav-anil-kumar-yadav-vinod-kumar-55536752

Introduction To Programming And Data Structures With C 4e Y Daniel


Liang Liang

https://ebookbell.com/product/introduction-to-programming-and-data-
structures-with-c-4e-y-daniel-liang-liang-35190274

Programming With C And Introduction To Data Structures Kogent Learning


Solutions Inc

https://ebookbell.com/product/programming-with-c-and-introduction-to-
data-structures-kogent-learning-solutions-inc-231673806

Data Structures With C Using Stl 2nd Edition William H Ford William R
Topp

https://ebookbell.com/product/data-structures-with-c-using-stl-2nd-
edition-william-h-ford-william-r-topp-46638186
Data Structures And Algorithms With C Pal Debdutta Halder Suman

https://ebookbell.com/product/data-structures-and-algorithms-with-c-
pal-debdutta-halder-suman-10525336

Data Structures And Algorithms With The C Stl A Guide For Modern C
Practitioners 1 Converted John Farrier

https://ebookbell.com/product/data-structures-and-algorithms-with-the-
c-stl-a-guide-for-modern-c-practitioners-1-converted-john-
farrier-55889290

Data Structures A Pseudocode Approach With C 2nd Edition Richard F


Gilberg Behrouz A Forouzan

https://ebookbell.com/product/data-structures-a-pseudocode-approach-
with-c-2nd-edition-richard-f-gilberg-behrouz-a-forouzan-33554888

Data Structures A Pseudocode Approach With C 2nd Edition Richard F


Gilberg Behrouz A Forouzan

https://ebookbell.com/product/data-structures-a-pseudocode-approach-
with-c-2nd-edition-richard-f-gilberg-behrouz-a-forouzan-37448042

Adts Data Structures And Problem Solving With C 2nd Edition 2nd
Edition Larry R Nyhoff

https://ebookbell.com/product/adts-data-structures-and-problem-
solving-with-c-2nd-edition-2nd-edition-larry-r-nyhoff-2253698
DATA STRUCTURES WITH C
PROGRAMMING
DATA STRUCTURES WITH C
PROGRAMMING

Dr. Anil Kumar Yadav and Vinod Kumar Yadav

ARCLER
P r e s s

www.arclerpress.com
Data Structures with C Programming
Dr. Anil Kumar Yadav and Vinod Kumar Yadav

Arcler Press
2010 Winston Park Drive,
2nd Floor
Oakville, ON L6H 5R7
Canada
www.arclerpress.com
Tel: 001-289-291-7705
        001-905-616-2116
Fax: 001-289-291-7601
Email: orders@arclereducation.com

e-book Edition 2019

ISBN: 978-1-77361-658-2 (e-book)

This book contains information obtained from highly regarded resources. Reprinted material
sources are indicated and copyright remains with the original owners. Copyright for images and
other graphics remains with the original owners as indicated. A Wide variety of references are
listed. Reasonable efforts have been made to publish reliable data. Authors or Editors or Publish-
ers are not responsible for the accuracy of the information in the published chapters or conse-
quences of their use. The publisher assumes no responsibility for any damage or grievance to the
persons or property arising out of the use of any materials, instructions, methods or thoughts in
the book. The authors or editors and the publisher have attempted to trace the copyright holders
of all material reproduced in this publication and apologize to copyright holders if permission has
not been obtained. If any copyright holder has not been acknowledged, please write to us so we
may rectify.

Notice: Registered trademark of products or corporate names are used only for explanation and
identification without intent of infringement.

© 2019 Arcler Press

ISBN: 978-1-77361-337-6 (Hardcover)

Arcler Press publishes wide variety of books and eBooks. For more information about
Arcler Press and its products, visit our website at www.arclerpress.com
ABOUT THE AUTHORS

Dr. Anil Kumar Yadav has done his B.Tech (CSE), M.Tech (I.T)
and PhD (Computer Science and Engineering) in the area of Machine
Learning specialization in Reinforcement Learning and Artificial
Intelligence. He has filed patent on topic Machine Learning, “Method
for Reinforcement Learning,”. He has been teaching data structures and
Artificial intelligence over the last 13 years at under graduate and post
graduate levels. With over a decade of teaching experience in the
engineering institutions, he has exemplified his work at various
designations. His research interests include data structures, deep
learning , machine learning algorithms specially reinforcement
learning, computational intelligence, computer vision and image
processing, brain computer/machine interface, intelligent informatics, soft-
computing in modeling and control, cognitive science. He has presented
papers at national and international conferences and published several
papers in international journals and also attended several workshops. He is
also a reviewer of some of the international journal and conferences.
Vinod Kumar Yadav has done his B.Tech (I.T), M.Tech (CSE). His area
of interest is Data mining, Artificial Intelligence and Machine Learning. He
has been teaching data structures over the last 7 years at under graduate and
post graduate levels. He is also GATE Qualified in Information Technology
in 2007. He has published many papers at national, international conferences
and international Journals. He also attended several national workshops.
TABLE OF CONTENTS

List of Figures.................................................................................................xi
Preface.................................................................................................... ....xvii

Chapter 1 Data Structures.......................................................................................... 1


1.1. Introduction......................................................................................... 2
1.2. Data Structure Basic Terminology........................................................ 2
1.3. Data Structure...................................................................................... 3
1.4. Introduction To Algorithm.................................................................... 8
1.5. Basic Concept of Function................................................................. 13
1.6. Basic Concept of Pointers.................................................................. 19
1.7. Introduction To Structure.................................................................... 22
1.8. Dynamic Memory Allocation In Data Structure................................. 28

Chapter 2 Array........................................................................................................ 35
2.1. Introduction....................................................................................... 36
2.2. Application of Array........................................................................... 36
2.3. Definition of Array............................................................................. 37
2.4. Representation of Array...................................................................... 37
2.5. Ordered List....................................................................................... 56
2.6. Sparse Matrices.................................................................................. 57
2.7. Garbage Collection............................................................................ 60

Chapter 3 Recursion................................................................................................. 63
3.1. Introduction....................................................................................... 64
3.2. Recursion.......................................................................................... 64
3.3. Tower of Hanoi ................................................................................. 72
3.4. Backtracking ..................................................................................... 74
Chapter 4 Stack........................................................................................................ 77
4.1. Introduction....................................................................................... 78
4.2. Definition of Stack............................................................................. 78
4.3. Operations on Stack.......................................................................... 80
4.4. Disadvantages of Stack...................................................................... 94
4.5. Applications of Stack......................................................................... 94
4.6. Expressions (Polish Notation)............................................................. 95
4.7. Evaluation of Postfix Expression......................................................... 98
4.8. Decimal To Binary Conversion........................................................... 99
4.9. Reversing The String......................................................................... 102

Chapter 5 Queue.................................................................................................... 105


5.1. Introduction..................................................................................... 106
5.2. Definition And Structure of Queue.................................................. 106
5.3. Operations on Queue...................................................................... 106
5.4. Circular Queue................................................................................ 114
5.5. D-Queue (Double Ended Queue).................................................... 119
5.6. Priority Queues................................................................................ 124
5.7. Application of Queue...................................................................... 128

Chapter 6 Linked List.............................................................................................. 129


6.1. Introduction..................................................................................... 130
6.2. Definition And Structure of Linked List............................................ 130
6.3. Characteristics of Linked List............................................................ 134
6.4. Types of Linked List.......................................................................... 135
6.5 Polynomial Representation of Linked List.......................................... 158

Chapter 7 Tree........................................................................................................ 161


7.1. Introduction..................................................................................... 162
7.2. Definition of Trees........................................................................... 162
7.3. Binary Tree...................................................................................... 165
7.4. Binary Tree Representation.............................................................. 169
7.5. Binary Tree Traversal........................................................................ 172
7.6. Binary Search Tree (BST).................................................................. 179
7.7. Height Balanced (AVL) Tree............................................................. 196

viii
Chapter 8 Graph..................................................................................................... 213
8.1. Introduction..................................................................................... 214
8.2. Definition of Graph......................................................................... 214
8.3. Representation of Graphs................................................................. 221
8.4. Graph Traversal................................................................................ 224
8.5. Spanning Tree.................................................................................. 229
8.6. Shortest Path Problem...................................................................... 240
8.7. Application Of Graph...................................................................... 243

Chapter 9 Sorting.................................................................................................... 245


9.1. Introduction..................................................................................... 246
9.2. Types of Sorting............................................................................... 246
9.3. Basic Terms of Sorting...................................................................... 246
9.4. Sorting Techniques........................................................................... 247

Chapter 10 Searching and Hashing........................................................................... 291


10.1. Introduction................................................................................... 292
10.2. Searching ...................................................................................... 292
10.3. Hashing......................................................................................... 296
10.4. Collision........................................................................................ 300
10.5. Collision Handling Method ........................................................... 301
10.6. Rehashing...................................................................................... 306
10.7. Application of Hashing.................................................................. 307

Index...................................................................................................... 309

ix
LIST OF FIGURES

Figure 1.1 Part of abstract data type.


Figure 1.2 Classification of data structures.
Figure 1.3 One-dimensional array.
Figure 1.4 Stack data structure
Figure 1.5 Queue structure.
Figure 1.6 Representation of link list.
Figure 1.7 Tree data structure.
Figure 1.8 A graph.
Figure 1.9 Big O notation.
Figure 1.10 Ω Notation.
Figure 1.11 ‘Ө’ Notation
Figure 1.12 Output a user-defined function.
Figure 1.13 Classification of function argument.
Figure 1.14 Output Call by Value to Pass Arguments.
Figure 1.15 Output of Call by Reference to Pass Arguments.
Figure 1.16 Output of Accessing variable through Pointers.
Figure 1.17 Output of Null Pointers.
Figure 1.18 Output of Structure Initialization.
Figure 1.19 Output structure pointer
Figure 1.20 Output of an Array of Structure.
Figure 1.21 Output of malloc and free function.
Figure 1.22 Output of calloc and free function.
Figure 1.23 Output of realloc Function.
Figure 2.1 One-dimensional Array.
Figure 2.2 Array initialization and accessing.
Figure 2.3 Output of Program Greater Number.

xi
Figure 2.4 Output of Program 2.3.
Figure 2.5 Array positions.
Figure 2.6 3 x 4 array two-dimensional.
Figure 2.7 Row major store in an array.
Figure 2.8 Column major store in an array.
Figure 2.9 Output of Program 2.4.
Figure 2.10 Output of Program 2.5
Figure 2.11 Output of Searching.
Figure 2.12 Output of Program Insertion.
Figure 2.13 Output of Program Deletion.
Figure 2.14 Output of Program Deletion.
Figure 2.15 Polynomial representation.
Figure 2.16 Sparse matrix.
Figure 2.17 Output of Sparse Matrix or not.
Figure 3.1 Output of a Factorial number Using Iteration Method.
Figure 3.2 Output of a Factorial number Using Recursion Method.
Figure 3.3 Output of Fibonacci Series.
Figure 3.4 Output for Check Prime number.
Figure 3.5 Initial Setup of Tower of Hanoi
Figure 3.6 After applying first Step position of Tower
Figure 3.7 After applying second step position of tower
Figure 3.8 After applying third step position of tower.
Figure 3.9 After applying fourth step position of tower.
Figure 3.10 Tree Example.
Figure 4.1 Stack Containing Items.
Figure 4.2 Stack using a 1-dimensional array.
Figure 4.3 Stack empty condition
Figure 4.4 Stack full condition.
Figure 4.5 Performing Push Operation.
Figure 4.6 Performing Pop Operation.
Figure 4.7 Stack Operation.

xii
Figure 4.8 Output Example 4.1.
Figure 4.9 Output of stack operation using linked list.
Figure 4.10 Output of Decimal to Binary
Figure 4.11 Output Reverse a String.
Figure 5.1 Queue structure.
Figure 5.2 Array Implementation of Queue.
Figure 5.3 (a) Queue in Memory.
Figure 5.3 (b) Queue after deleting the first element.
Figure 5.3 (c) Queue after inserting an element.
Figure 5.4 Output of Queue Operations.
Figure 5.5 Output of Queue operation using Linked List.
Figure 5.6 Linear Queue.
Figure 5.7 Circular Queue.
Figure 5.8 Output of Circular Queue Operations
Figure 5.9 D-Queue.
Figure 5.10 (a) Input-restricted D-queue.
Figure 5.10 (b) Output-restricted D-queue.
Figure 5.11 Output of D-Queue Operations.
Figure 5.12 Output of Priority Queue.
Figure 6.1 Structure of a Node
Figure 6.2 Representation of link list.
Figure 6.3 Output of Linked List.
Figure 6.4 A singly-linked list containing three integer values.
Figure 6.5 Output of Single linked list operations.
Figure 6.6 Output of Circular Linked List Operations.
Figure 6.7 Doubly Linked List.
Figure 6.8 Output of Doubly linked list Operations.
Figure 6.9 Structure of a polynomial node.
Figure 6.10 List structure of polynomial.
Figure 6.11 Linked representation of a polynomial two variable.
Figure 7.1 Tree.
Figure 7.2 a, b and c represent a forest.

xiii
Figure 7.3 An example of Tree.
Figure 7.4 Binary tree.
Figure 7.5 Strictly Binary Tree
Figure 7.6 Almost Complete.
Figure 7.7 Complete Binary Tree.
Figure 7.8 Extended Binary Tree.
Figure 7.9 (a) Left -skewed binary tree (b) Right – skewed binary tree.
Figure 7.10 General Tree.
Figure 7.11 Expression Tree.
Figure 7.12 Sequential representation of a binary tree.
Figure 7.13 Structure of a node binary tree.
Figure 7.14 Linked List Representation.
Figure 7.15 Binary Tree (a) and (b).
Figure 7.16 Binary Tree (a) and (b).
Figure 7.17 Binary Tree (a) and (b).
Figure 7.18 Finally Binary Tree.
Figure 7.19 Computing pointer in a binary tree.
Figure 7.20 A threaded binary tree.
Figure 7.21 Binary Search Tree.
Figure 7.22 Binary Search Tree.
Figure 7.23 Before deletion.
Figure 7.24 After deletion.
Figure 7.25 Before deletion.
Figure 7.26 After deletion of a node from the tree.
Figure 7.27 Before deletion.
Figure 7.28 After the deletion of a node from the tree.
Figure 7.29 Red-Black Tree.
Figure 7.30 AVL tree.
Figure 7.31 Not an AVL tree.
Figure 7.32 Classification of Rotation.
Figure 7.33 Balanced AVL search tree.
Figure 7.34 AVL search tree after performing LL rotation.

xiv
Figure 7.35 Balanced AVL search tree.
Figure 7.36 AVL search tree after performing RR rotation
Figure 7.37 Balanced AVL search tree.
Figure 7.38 AVL search tree after performing LR rotation.
Figure 7.39 Balanced AVL search tree.
Figure 7.40 AVL search tree after performing RL rotation.
Figure 7.41 AVL tree Exercise of 7.4
Figure 7.42 Weight Balance Tree.
Figure 8.1 Simple Graph.
Figure 8.2 A Directed Graph.
Figure 8.3 An Undirected Graph.
Figure 8.4 A Complete Graph.
Figure 8.5 A Sub Graph.
Figure 8.6 A connected graph.
Figure 8.7 A Multigraph.
Figure 8.8 A Graph with four Vertices.
Figure 8.9 A directed graph with four Vertices.
Figure 8.10 A Null Graph.
Figure 8.11 An Isomorphic Graph.
Figure 8.12 A Homeomorphic Graph.
Figure 8.13 An Undirected Graph.
Figure 8.14 A Directed Graph.
Figure 8.15 Linked list representation of Figure 8.14.
Figure 8.16 An Undirected Graph.
Figure 8.17 Linked list of Figure 8.16.
Figure 8.18 Graph with six vertices.
Figure 8.19 An undirected graph.
Figure 8.20 An undirected graph.
Figure 8.21 An undirected graph.
Figure 8.22(a) Undirected Graph.
Figure 8.22(b) Spanning Tree.
Figure 8.23 Undirected Graph.

xv
Figure 8.24 Minimum spanning tree Graph of 8.23.
Figure 8.25 Undirected Graph G.
Figure 8.26 A Minimum Spanning tree of Figure 8.25.
Figure 8.27 Undirected Graph G.
Figure 8.28 Undirected Graph G.
Figure 8.29 A Minimum Spanning tree of Figure 8.27
Figure 8.30 Unweighted graph
Figure 8.31 A Graph.
Figure 9.1 Output of Bubble Sort.
Figure 9.2 Output of Insertion Sort.
Figure 9.3 Output of Selection Sort.
Figure 9.4 Output of Merge Sort element.
Figure 9.5 Output of merge sort for two unsorted list.
Figure 9.6 Quick Sort.
Figure 9.7 Output of Quick Sort element.
Figure 9.8 Output of Heap Sort.
Figure 9.9 Output of Radix sort elements.
Figure 10.1 Output for Binary search.
Figure 10.2 A small phone directory book as a hash table.
Figure 10.3 Chaining.
Figure 10.4 Rehashing.

xvi
PREFACE

The significant role of Data Structures is famous for Computer Science and
Engineering. This book is about the structure, actions and the principle of a
different data type that help improve the ability to write an efficient algorithm,
program and Analysis algorithm and program complexity. In this book, we
present the fundamental concepts, operations, and algorithms for different types
of data structures. This makes an understanding of this subject more lucid and
makes it more interesting. This book, intended for the first course in the data
structure at the junior or senior undergraduate level.
This book prepared according to the syllabus of various Universities and
conceived as a textbook for the course of Bachelor of Engineering or Technology
of different branches of computer science. The contents of the book have been
thoroughly organized and spread over ten chapters. Each chapter begins with
the basics and describes with syntax, diagrams, and examples. Each concept
of data structure has implemented in the C programming language. The book
not only covers the scope of the subject but also explains the philosophy of the
subject.
We trust the textbook would meet the requirements of both the teachers and
the students. We would very much appreciate receiving any suggestions for
improvement in the book from teachers, students, and other readers.
We wish to express our deep thanks to all those who helped in making this book
a reality.
We express our gratitude to our publisher and the team of publications that have
taken great pains in publishing the book with speed and accuracy.
1
CHAPTER

DATA STRUCTURES

CONTENTS
1.1. Introduction......................................................................................... 2
1.2. Data Structure Basic Terminology........................................................ 2
1.3. Data Structure...................................................................................... 3
1.4. Introduction To Algorithm.................................................................... 8
1.5. Basic Concept of Function................................................................. 13
1.6. Basic Concept of Pointers.................................................................. 19
1.7. Introduction To Structure.................................................................... 22
1.8. Dynamic Memory Allocation In Data Structure................................. 28
2 Data Structures with C Programming

1.1. INTRODUCTION
In the Computer Programming or Software development, Data Structures is
one of the most valuable roles for computer engineers. Use of appropriate
data structures enables a computer system to perform its task more efficiently,
by influencing the ability of computers to store and retrieve data from any
location in its memory. A data structure is a method of how storing data on
a computer so that it can be used efficiently. In Computer Programming we
are using different types of data to perform, store, access and sent data and
information. Computers cannot do without data, so organizing that data is
very important. If that data is not organized effectively, it is very difficult to
perform any task on that data. If it is organized effectively then any operation
can be performed easily on that data.

1.2. DATA STRUCTURE BASIC TERMINOLOGY

1.2.1. Data and Data Types


Data are a group of specific facts, numbers, character, and figures. A data item
refers to a single unit of values. Data is an unprocessed form of information.
Data is plural and datum is singular form. Data items that are divided into
subitems are called group items; those are not called elementary items. For
examples, an employee’s name may divide into three subitems: first name,
middle and last name. Data is numerical, character, symbols or any other
kind of information. A Data Types consists of a set of values and a set of
operations. A data type is a name which refers to kinds of data that variables
may hold in the programming language. The data is stored in the memory
at some location. By using the name of the variable, one can access the data
from that memory location easily. For example in ‘C’ language, the data
types are int (integer value), float (decimal value), char (character), double
(real value of large range) etc. Data types divided into categories: Built-in
data types (Primitive Data) and User define data types (Non-primitive
Data). Generally, a programming language supports a set of built-in data
types and allow the user to define a new type those are called user-defined
data types.
Information: Information is related to an attribute or a set of attributes
of an object. Examples are the number of students in a class, length of the
room, and the component of a computer. The fundamental component of
information is the Data; “Information is a collection of data. When data
Data Structures 3

are processed or organized it gives meaningful and logical knowledge it


becomes information.”
Abstract Data Type: The abstract data type is a triple of D-Set of
domains, F-Set of functions, A-Axioms in which only what is to be done is
mentioned but how is to be done is not mentioned. At ADT, all the all the
implementation details are hidden.
In short: ADT = Type + Function Names + Behaviors of Each
function
An abstract data type can declare the data type and without explanation
operations to how it will be implemented. Applications that use the data type
are unaware of implementation; they only make use of the operations that
defined abstractly. If we want to change implementations, we have to do is
rewrite the operations. No matter how large our application is, the cost of
changing implementations is the same. The abstract data type is written with
the help of the instances and operations.
Implementation: The part that implements the abstract data type.
These two pieces are completely independent. It should be possible
to take the implementation developed for one application and use it for a
completely different application with no changes.

Figure 1.1: Part of abstract data type.

1.3. DATA STRUCTURE


Definition: The data structure can be defined as the organization of data
or elements and all possible operations, which are required for those set of
data. It is a logical or mathematical representation and organization of any
data is known as a data structure. Some of the data structures are arrays,
stacks, queues, linked lists, trees, and graphs, etc.
4 Data Structures with C Programming

“The well-organized collection of data and all feasible operations on


data is called a data structure.”
Data Structure = Organized data (mathematical or logical) + Accept-
able operations

1.3.1. Basic Operation of Data Structures


The following operations play a major role in data processing on data
structures:
• Traversing: Accessing each record exactly once so that certain
items in the record may be processed. This process is also called
visiting the record.
• Inserting: adding a new record to the structure.
• Deleting: Removing a record from the structure.
• Searching: Finding the location of record with a given key value,
or finding the locations of all records which satisfy one or more
conditions.
• Sorting: Arranging the records in some logical order.
• Merging: Combining the records in two different files into a
single file.

1.3.2. Classification of Data Structures

Figure 1.2: Classification of data structures.


The data structures are generally divided into two categories.
1. Primitive Data type: These are basic data that are directly
operated upon machine instructions. These have different
Data Structures 5

representations on different computers. Such as int, float, char,


double which are defined by programming language itself.
a) Integer Data Type: This type of data is used to store the
integer value in a variable. The value should not contain
any fraction data.
Example: int a;
a = 10; is acceptable but
a = 10.05 is not acceptable.
b) Float Data Type: This type of data is used to store the
real values in a variable. The value may have some
fractional or decimal data.
Example: float a;
a = 10; is acceptable but it will be interpreted as a = 10.0
a = 10.05 is acceptable.
c) Character Data Type: This type of data is used to store
some text or alphabets in a variable. The character is
always written within single quotes.
Example: char answer;
answer = “T”;
d) Double Data Type: This type of data is used to store the
numeric value in the variable. It is same as of float data
type but the capability of this data type is larger than the
float data type size.
Example: double a;
a = 10.0000000100
2. Non-Primitive Data type: These are more sophisticated data,
which are derived from the primitive data. The user defines
data emphasize the structuring of a group of homogeneous or
heterogeneous data items.
Linear Data Structure: Linear data structures are the data
structures in which data is arranged or accessed (read or write) in
straight sequence or the consecutive way one by one in a list.
Examples: Arrays, Stacks, Queues, and List.
a) Array: it is a collection of all the elements with similar
data types. The array is the collection of a finite number
of homogenous data element such that the elements
of the array are referenced respectively by an index
6 Data Structures with C Programming

set consisting of ‘n’ consecutive numbers and stored


respectively in successive memory locations.
Example: int A[4]; The computer reserved four storage locations as
shown below:

Figure 1.3: One-dimensional array.


b) Stack: it is a data structure which follows last in first out
(LIFO) mechanism. It means the first element will insert
is to remove the last one. Example: if a stack of elements
40, 60, 80, and 100. Here 20 will be the bottommost
element and 100 will be the topmost element in a stack.
A stack is shown in Figure 1.4.

Figure: 1.4: Stack data structure.

Figure 1.5: Queue structure.


c) Queue: It is a data structure, which follows, first in first
out (FIFO) mechanism. It means the first element inserted
is the first one to remove. Queue uses two variables rear
and front.
d) Linked List: A linked list is a set of nodes where each
node has two fields: an information or data and link or
next address field. The ‘data’ field store actual piece of
Data Structures 7

information, which may be an integer, a character, a


string or even a large record and ‘link’ field is used to
point to next node. Hence link list of integer 20, 40, 60,
80 is shown in Figure 1.6.

Figure 1.6: Representation of link list.


Non-Linear data structures: Non-Linear data structures are the data
in which data may be arranged in unordered or hierarchical manner; for
example, Trees, Graphs.
a) Tree: it is a non-linear data structure in which data are
arranged in a sorted sequence. It is used to represent the
hierarchical relationship of several data items.

Figure 1.7: Tree data structure.


b) Graph: A graph is a non-linear data structure which
consists of set of nodes called vertices V and set of edges
E which links vertices. From Figure 1.8, V (G) = {1, 2, 3,
4,5,6}, E(G) = {(1,2),(2,1),(2,3), (3,2), (1,4), (4,1), (4,5),
(5,4), (5,6), (6,5), (3,6),(6,3)}

Figure 1.8: A graph.


8 Data Structures with C Programming

1.4. INTRODUCTION TO ALGORITHM


An algorithm is composed of a finite set of steps, each of which may require
one or more operations. An algorithm is a finite set of instructions that, if
followed, accomplished a particular task. Example: The algorithm makes
the sum of two numbers 20 and 30.
Step 1: Start
Step 2: Store 20 into X and 30 into Y.
Step 3: Calculate SUM = X + Y.
Step 4: Print the value of SUM.
Step 5: Stop.
Basic Characteristics of An algorithm:
• Input: an algorithm should have zero or more inputs are externally
supplied.
• Output: At least one quantity is produced.
• Definiteness: Each instruction is clear and unambiguous.
• Finiteness: if we trace out the instructions of the algorithm, then
for all cases, the algorithm terminates after a finite number of
steps.
• Effectiveness: Every instruction must be very basic so that it can
be carried out, in principle, by a person using only a pencil and
paper.
A program is the expression of an algorithm in a programming language.
Sometimes words such as procedure, function, and subroutine are used
synonymously for the program.
Program = Data structure + Algorithms

1.4.1. Analysis of Programs


The analysis of the program does not mean simply working of the program,
but to check whether for all possible situations program works or not. The
analysis also involves working of the program efficiently. Efficiency in the
sense,
1. The program requires less amount of storage space.
2. The programs get executed in very less amount of time.
Data Structures 9

The time and space are factors which determine the efficiencies of the
program. The time required for execution of the program cannot be computed
in terms of seconds because of the following factors.
1. The hardware of the machine.
2. The amount of time required by each machine instruction.
3. The amount of time required by the compilers to execute the
instruction.
4. The instruction set.

1.4.2. Complexity of an Algorithm


The analysis of algorithms is a major task in computer science. In order to
compare algorithms, there must be some criteria for the major effects of
algorithms. The algorithm can be evaluated by a variety of criteria. The rate
of growth of the time or space required to solve larger and larger instance of
a program. There are three conditions for complexity theory is as follows:
• Worst case: The worst-case time complexity is the function
defined by the maximum amount of time needed by the algorithm
for an input of size, ‘n.’ Therefore, it is a function which defined
by the maximum number of steps taken for any instance that size
‘n.’
• Average case: The average case time complexity is the execution
of an algorithm having typical input data of size ‘n.’ Therefore, it
is a function which defined by the average number of steps taken
for any instance that size ‘n.’
• Best case: The best case time complexity is the minimum
amount of time that an algorithm requires for an input of size ‘n.’
Therefore, it is a function which defined by the minimum number
of steps taken for any instance that size ‘n.’
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 following components-
• A fixed part that includes space for the code, space for simple
variable and fixed size component variables.
• The variable part that consists of the space needed by the
component variable where size is dependent on the particular
problem.
10 Data Structures with C Programming

The space requirement S (P) of any algorithm P may, therefore, be


written as
S (P) = c + Sp
where c is a constant and Sp instance characteristics.
Time Complexity: The time complexity of an algorithm is the amount
of computer time it needs to run to completion. The time T (P) taken by a
program P is the sum of the compile time and the run (or execution) time.
The compile time does not depend on the characteristics. We assume that
the compiled program will run several times without recompilation. We
concern ourselves with just time of a program. This runtime is denoted by
Tp (instance characteristics). If we knew the compiler characteristics to be
used, we could continue to determine the number of additions, subtractions,
multiplications, divisions, compares, stores and so on, that would be made
by the code for P.
Tp (n) = ca ADD (n) + cs SUB (n) + cm MUL (n) + …
Here n denotes the instance characteristics, and ca, cs, cm and so on.

Efficiency of Algorithms
If we have two algorithms that perform the same task, and the first one has
a computing time of O(n) and the second of O(n2), then will usually prefer
the first one. The reason for this is that as n increases the time required for
the execution of second algorithms will get far more than the time required
for the execution of the first. We will study various values for computing
function for the constant values.
log2n > n > n log2n > n2 > n3 > 2n
Notice how the times O(n) and O(n log2 n) grow much more slowly
than the others. For large datasets algorithms with a complexity greater than
O(n log2 n) are often impractical. The very slow algorithm will be the one
having time complexity 2n.

1.4.3. Complexity Notations of Algorithm


To choose the best algorithm, we need to check the efficiency of each
algorithm. The efficiency can be measured by the computing time complexity
of each algorithm asymptotic notation is a shorthand way to represent the
time complexity. Various notations such as Ω, Ө, and O used are called
asymptotic notions.
Data Structures 11

1. Big (O) Notation: The big oh notation is denoted by ‘O.’ It is a


method of representing the upper bound of algorithm’s running
time. Using big oh notation we can give the longest amount of
time taken by the algorithm to complete.
Definition: Let f(n) and g(n) be two non-negative functions.
Let n0 and constant c are two integers such that n0 denotes some value of
the input and n > n0. Similarly, c is some constant such that c > 0. We can
write
F (n) c* g(n)
Then F (n) is big oh of g(n). It is also denoted as F(n) Є O (g(n)). In other
words, F(n) is less then g(n) is multiple of some constant c.

Figure 1.9: Big O notation.


Example: Consider function F(n) = 2n + 2 and g(n) = n2. We have to
find some constant c, so that F(n) ≤ c * g(n). As F(n) = 2n+2 and g(n) = n2.
Find for n = 1, F(n) = 2n + 2 = 2(1) +2, F(n) = 4; and g(n) = n2 = (1)2 ,
g(n) = 1
i.e., F(n) > g(n)
if n = 2 then, F(n) = 2n + 2 = 2(2) +2, F(n) = 6; and g(n) = n2 = (2)2,
g(n) = 4
i.e., F(n) > g(n)
if n = 3 then, F(n) = 2n + 2 = 2(3) +2, F(n) = 8; and g(n) = n2 = (3)2,
g(n) = 9
i.e., F(n) < g(n) is true.
Hence we can conclude that for n > 2, we obtain, F(n) < g(n). Thus
always upper bound of existing time is obtained by big O notation.
12 Data Structures with C Programming

2. Omega ‘Ω’ Notation: Omega notation is denoted by ‘Ω.’ This


notation is used to represent the lower bound of algorithm’s
running time. Using omega notation we can denote the shortest
amount of time taken by the algorithm.
Definition: A function F(n) is said to be in Ω (g(n)) if F(n) is bounded
below by some positive constant multiple of g(n) such that F(n) ≥ c * g(n)
for all n ≥ n0.
It is denoted as F(n) Є Ω (g(n)). Following graph illustrates the curve
for Ω notation.

Figure 1.10: Ω notation.


Example: consider F(n) = 2n2 + 5 and g(n) = 7n.
if n = 0, then F(n) = 2(0)2 + 5 = 5 and g(n) = 7 (0) = 0 i.e., F(n) >
g(n)
if n = 1, F(n) = 2(1)2 + 5 = 7 and g(n) = 7 (1) = 7 i.e., F(n)
= g(n)
If n = 2, F(n) = 2(2)2 + 5 = 13 and g(n) = 7 (2) = 14 i.e., F(n)
< g(n)
If n = 3, F(n) = 2(3)2 + 5 = 23 and g(n) = 7 (3) = 21 i.e., F(n) > g(n)
Hence we can conclude that n > 3, we obtain F(n) > c * g(n). It can be
represented as 2n2 + 5 Є Ω (n). Thus always lower bound of existing time is
obtained by Ω notation.
3. ‘Ө’ Notation: The theta notation is denoted by Ө. By this method
the running time is between upper bound and lower bound.
Definition: Let F(n) and g(n) be two nonnegative functions. There are
two positive constants namely c1 and c2 such that c1 g(n) ≤ F(n) ≤ c2 g(n).
Thus we can say that, F(n) Є Ө (g(n))
Data Structures 13

Figure 1.11: ‘Ө’ Notation


Example: consider F(n) = 2n + 8 and g(n) = 7n, where n ≥ 2.
Similarly F(n) = 2n + 8 and g(n) = 7n
i.e., 5n < 2n + 8 < 7n For n ≥ 2
Here c1 = 5 and c2 = 7 with n0 = 2. The theta notation is more precise with
big oh and omega notation.
The complexity of Notations:

Notation Best Case Worst Case Average Case


Big ‘O’ (Upper) Yes
Omega ‘Ω’ (Lower)Yes
Theta ‘Ө’ (Middle) Yes

1.5. BASIC CONCEPT OF FUNCTION


When we are writing a program in C language, each program uses at least
one function, which is known as main() function. If we are writing code for
an application in C language, you require performing the same task more
than one time. In such case you have two options:
1. Use the same set of code each time when you want to perform the
task.
2. Create a function to perform that task, and just call it every time
when you need to perform that task.
Definition: A function is a collection of instruction or code that performs
together and completes a particular task. A function can also be referred to
as a method or a sub-routine or a procedure, etc.
Functions are used because of the following reasons:
14 Data Structures with C Programming

• To get better readable and writable of code.


• Introduce the concept of code reusability, the same function can
be used in any program rather than writing the same code.
• Debugging of the code would be easier if you use functions, as
errors are easy to be traced.
• Reduces the size of the code, a duplicate set of statements are
replaced by function calls.

1.5.1. Types of Functions


There are basically two types of functions.
• Predefined Standard Library Functions: In the C language
we use some predefined functions such as main(), puts(), gets(),
printf(), scanf(), getch() etc. These functions which are already
define and declare in header files (.h files like stdio.h, conio.h), so
we call them whenever you like to use these functions.
• User Defined Functions: The functions that we create in a
program are known as user-defined functions. So, we will study
how to build user-defined functions and how to use them in C
Programming.

1.5.2. Build a User Define Function


The common form of a function definition in C programming language is
as follows.
Syntax: return_type function_name(parameter list) //Header of
function
{
//Body of the function
}
Example: int greater(int n1, int n2) {
int result ; /* local variable declaration */
if (n1 > n2)
result = n1;
else
result = n2;
return result; }
Data Structures 15

A function consists of a header and a body. Some parts of a function


described below:
Function Return Type: A function may return a value. The return_type
is the type of value that function returns. Several functions are performing
the operations without returning a value. In this condition, the return_type
is the void.
Function Name: it is the identifier of a function. The name and the
parameter list compose together and make the function name.
Function Parameters: A parameter is like a placeholder. When a
function is executed, we pass a value to the defined parameter. This value is
referred to as the actual parameter or argument. The parameter list refers to
the type, order, and a number of the parameters in a function. Parameters are
optional in a function may contain or not.
Function Body: The function body contains the statement or collection
of code that defines what the function performs and return.

1.5.3. Function Declarations and Call


A function declaration identifies the compiler about a function name, return
type, parameters and how to call the function during compilation of the
program. The body of the function can be defined independently.
Syntax: return_type function_name(parameter list);
Example: int greater(int n1, int n2);
Parameter names are not essential in function declaration only their type is
required, so the following is also a valid declaration:
int greater(int, int);
Declaration of a function is required when we define a function in one
program and we call that function in another program. In this case, we should
declare the function at the top of the program and be calling the function.
Calling a Function: any program when we call a function, the control
of the program is transferred to the called function. This called function
performs a defined task and its return when the statement is executed or
when the closing brace is reached. The program control returns back to
the main program. Calling a function, you only need to pass the required
parameters along with the function name, and if the function returns a value,
then you can store the returned value.
16 Data Structures with C Programming

Program 1.1: Build a User Defined Function


#include<stdio.h>
#include<conio.h>
int greater(int n1, int n2); /* function declaration */
void main ()
{
clrscr(); /* local variable definition */
int a = 18;
int b = 29;
int ret;
ret = greater(a,b); /* calling a function to greater value
*/
printf(“Greater value is : %d\n,” ret);
getch(); }
int greater(int n1, int n2) /* function returning the greater between two
numbers */
{ int result; /* local variable declaration */
if (n1 > n2)
result = n1;
else
result = n2;
return result;
}
The output of the program is given in Figure 1.12.

Figure 1.12: Output a user-defined function.

1.5.4. Function Arguments


On the basis of function, parameter arguments are categorized. There are
two types of function are available in the C language, as shown in Figure
1.13.
Data Structures 17

Figure 1.13: Classification of function argument.


There are two ways in which arguments can be passed to a function:
a) Call by value: This method copies the actual value of an argument
into the formal parameter of the function. New memory area
created for the passed parameters can be used only within the
function. The actual parameters cannot be modified here. In this
condition, changes are made to the inside parameter the function
have no effect on the argument. By default, C uses call by value
to pass arguments in the parameter. In general, it means the code
within a function cannot change the arguments used to call the
function.

Program 1.2: Call by Value to Pass Arguments


#include<stdio.h>
#include<conio.h>
int sum(int n1, int n2); /* function declaration */
void main()
{
clrscr();
int ans;
int n1 = 100;
int n2 = 500;
ans = sum(n1,n2); /* calling a function to get addition value */
printf(“The sum of two numbers is: %d\n,”ans);
getch();
}
int sum(int a,int b) /* function returning the sum of two numbers */
18 Data Structures with C Programming

{
return a + b;
}

The output of the program is given in Figure 1.14.

Figure 1.14: Output Call by Value to Pass Arguments.


b) Call by Reference: This method copies address of an argument
into the formal parameter. Inside the function, Address operator
(&) is used in the parameter for the called function. This means
that changes made to the parameter affect the original variables.

Program 1.3: Call by Reference to pass Arguments


#include<stdio.h>
#include<conio.h>
void swap(int *n1, int *n2)
{
int temp;
temp = *n1;
*n1 = *n2;
*n2 = temp;
}
void main()
{
int n1 = 10, n2 = 20;
clrscr();
printf(“\nBefore swap value of n1:%d,”n1);
printf(“\nBefore swap value of n2:%d,”n2);
swap(&n1, &n2); // passing value to function
printf(“\nafter swap value of n1: %d,”n1);
printf(“\nafter swap value of n2: %d,”n2);
getch();
}
The output of the program is given in Figure 1.15.
Data Structures 19

Figure 1.15: Output of Call by Reference to Pass Arguments.

1.5.5. Main Features of Function


• The basic intention of the function is the reuse of code.
• Use of any function we can invoke (call) any another functions.
• All the time compilation will take place from top to bottom.
• All the time execution process will starts from main() and ends
with main() function only.
• In function definition first line is called function declaration or
function header.
• Always function declaration should be matched with function
declaratory.
• In implementation whenever a function does not return any values
back to the calling place then specify the return type.
• void means nothing that is no return value.
• In implementation whenever a function returns other than void
then specify the return type as return value type that is one type
of return value it is returning the same type of return statement
should be mentioned.
• Default return type of any function is an int.
• Default parameter type of any function is void.

1.6. BASIC CONCEPT OF POINTERS


A pointer is a variable which stores the address of another variable, of the
memory location. Similar to any variable or constant, we must declare a
pointer before using it to store any variable address. If the variable name
is preceded by an asterisk or * then such variable is called pointer variable.
The Syntax of a pointer variable declaration is:
Syntax: Data type * variable_name;
20 Data Structures with C Programming

Here, the data type is the type of pointers it must be valid in C data and
variable_name is the name of the pointer variable. The asterisk * used to
declare a pointer.
Some examples are given that are the valid pointer declarations:
int *i; /* pointer to an integer */
float *f; /* pointer to a float */
char *c /* pointer to a character */
The * symbol informs the compiler that we use a pointer variable, the
actual data type of the value of all pointers.

1.6.1. Operations on Pointers


There are some essential operations used for pointers initialization and
accessing the variable through pointers.
a. We define and declare a pointer variable;
b. Assign the address of a variable to a pointer; and
c. Lastly, access the value at the address available in the pointer
variable.
This is done by using unary operator * that returns the value of the
variable located at the address specified by its operand. We have used two
important operators * and &. The * means ‘value at a specified memory
address’ and & means the ‘memory address at.’ The following example
makes use of these operations.
Example: int *ip; /* pointer variable define */
int a,b; /* normal variable define */
a = 100; /* store value in a variable */
ip = &a; /* store memory address of a in ip */
b = *ip; /* getting value from memory address in ip and store in b
variable */
Example: int *ip; float a,b;
a = 4.3;
b = 3.8;
ip = &a /* this is wrong*/

Program 1.4: Accessing variable through Pointers


#include<stdio.h>
Data Structures 21

#include<conio.h>
void main ()
{
clrscr();
int a = 20; /* actual variable declaration */
int *ip; /* pointer variable declaration */
ip = &a; /* store address of a in pointer variable*/
printf(“\nAddress of a variable: %x\n,” &a); /*address stored in pointer
variable*/
printf(“\nAddress stored in ip variable: %x\n,” ip); /*access value using
pointer */
printf(“\nValue of *ip variable: %d\n,” *ip);
getch();
}
The output of the program is given in Figure 1.16.

Figure 1.16: Output of Accessing variable through Pointers.

1.6.2. NULL Pointers


The NULL pointer means a constant with a value of zero defined in several
standard libraries. This is done at the time of variable declaration. A pointer
variable that is assigned by NULL is called a null pointer.

Program 1.5: For Null Pointer


#include<stdio.h>
#include<conio.h>
void main ()
{
clrscr();
int *ptr = NULL;
printf(“The value of ptr is : %x\n,” ptr );
getch();
}
22 Data Structures with C Programming

The output of the program is given in Figure 1.17.

Figure 1.17: Output of Null Pointers.

1.7. INTRODUCTION TO STRUCTURE


The structure is a non-primitive or user-defined data type in C languages
which allows joining together different data types to store a particular type
of record. The structure is slightly related to an Array. The only difference is
that array is used to store a collection of homogeneous or similar data types,
even as the structure can store a collection of the dissimilar type of data. The
structure is used to represent a record. Suppose you want to store records of
Student which consists of student name, address, roll number and age. You
can define a structure to hold this information.

1.7.1. Defining a Structure


To define a structure struct keyword is used. struct defines a new user-
defined data type which is a collection of different types of data that is
known as members of the structure. The closing braces in the structure type
declaration must be followed by a semicolon “;”.
Syntax: struct structure_name {
data_type member1;
data_type member2;
.
.
data_type member n; //declaration of different data types
};
Example: struct Library
{
char Bookname[15];
char Authorname[15];
int volume;
float price; };
Here the above example struct Library declares a structure to hold
the details of the book in the library which consists of four data fields,
Data Structures 23

namely Bookname, Authorname, volume, and price. These fields are called
structure elements or members. Each data member can have a different
data type, like Bookname and Author name is of char type, the volume is int
type and price is of float type etc. The library is the name of the structure
and is called structure tag.

1.7.2. Declaring Structure Variables


After a structure is defined, it is feasible to declare variables of a structure.
Structure variable declaration is similar to the declaration of variables of
any other data types. Structure variables can be declared in the following
two ways.
a) Declaring Structure variables individually
struct Student
{
char name[10];
int age;
int semester;
}; struct Student S1 , S2; //declaring variables of Student
b) Declaring Structure Variables with Structure definition
struct Student
{
char name[20];
int age;
int semester;
} S1, S2; //declaring variables of Student
Here S1 and S2 are variables of structure Student.

1.7.3. Accessing Structure Members


In the Structure, each data members can be accessed and assigned values in
the variable using a particular method. In order to assign a value to a structure
member, the member name must be associated with the structure variable
using a dot “.” operator also called period or member access operator.
struct Library
{
char Bookname[15];
char Authorname[15];
int volume;
24 Data Structures with C Programming

float price;
} L1, L2;
L1.price = 200.50; //L1 is variable of Library type and the price is a mem-
ber of Library
We can also use scanf() to give values to structure members through the
terminal.
scanf(“ %s ,” L1.Bookname);
scanf(“ %d ,” &L1.price);

1.7.4. Structure Initialization


Similar to any other data type, structure variable can also be initialized at
compile time.
struct Library
{
char Bookname[30];
char Authorname[30];
int volume;
float price; };
struct Library L1 = { “Data Structure,” “Vinod Kumar Yadav,”1 , 275.50 };
//initialization
or
We can initialize value using member access operator.
struct Library L1;
L1.Book name = “Data Structure”; //initialization of each member sepa-
rately
L1.Author name = “Vinod Kumar Yadav”;
L1.volume = 1;
L1.price = 275.50;

Program 1.7: Structure Initialization


#include<stdio.h>
#include<conio.h>
struct Library {
char Bookname[50];
char Authorname[50];
int volume;
float price; } l;
void main() {
clrscr();
Data Structures 25

printf(“Enter information:\n”);
printf(“Enter Book Name: “);
scanf(“%s,” l.Bookname);
printf(“\nEnter Author Name:”);
scanf(“%s,”l.Authorname);
printf(“\n Enter volume number: “);
scanf(“%d,” &l.volume);
printf(“\n Enter Price of Book: “);
scanf(“%f,” &l.price);
printf(“\nDisplaying Information:\n”);
printf(“Book Name: “);
puts(l.Bookname);
printf(“Author name: %s\n,”l.Authorname);
printf(“Volume: %d\n,” l.volume);
printf(“Price: %f \n,” l.price);
getch(); }
The output of the program is given in Figure 1.18.

Figure 1.18: Output of Structure Initialization.

1.7.5. Pointers to Structures


In the structure we can define pointers to structures in the same way as
we define pointer to any other variable. By using pointer to structure the
members can be accessed with →.
Syntax: struct structure_name * variable_name;
Example: struct Books *struct_pointer;
struct_pointer = &Book1;
Just now, we can store the address of a structure variable in the above
defined pointer variable. To get the address of a structure variable we place
the ‘&’ operator before the structure’s name as follows. To access the
26 Data Structures with C Programming

members of a structure using a pointer to that structure, you must use the →
operator as follows:
struct_pointer→ title;

Program 1.8: For structure pointer


#include <stdio.h>
#include <string.h>
#include<conio.h>
struct Books
{
char title[50];
char author[50];
char subject[100];
int book_id; };
void printBook(struct Books *book); /* function declaration */
void main() {
clrscr();
struct Books Book1; /* Declare Book1 of type Book */
struct Books Book2; /* Declare Book2 of type Book */
strcpy(Book1.title, “C Programming”);
strcpy(Book1.author, “Yashwant Kanitkar”);
strcpy(Book1.subject, “C Programming Tutorial”);
Book1.book_id = 649;
strcpy(Book2.title, “Data Structure”);
strcpy(Book2.author, “Vinod Kumar Yadav”);
strcpy(Book2.subject, “Data Structure Tutorial”);
Book2.book_id = 651;
/* display Book1 information by passing address of Book1 */
printBook(&Book1);
/* display Book2 information by passing address of Book2 */
printBook(&Book2);
getch(); }
void printBook(struct Books *book) {
printf(“Book title : %s\n,” book->title);
printf(“Book author : %s\n,” book->author);
printf(“Book subject : %s\n,” book->subject);
printf(“Book book_id : %d\n,” book->book_id); }
The output of the program is given in Figure 1.19.
Data Structures 27

Figure 1.19: Output structure pointer.


We are using the simple structure the members of structure accessed
with the dot operator and when the access structure by the pointer variable
then use → operator.

1.7.6. Array of Structure


In the structure, we can also declare an array of structure. Each element of
the array represents a structure variable. Example: struct Staff st[5]; The
below program define an array st of size 5 elements. Each element of array
st is of type employee.

Program 1.9: Array of Structure


#include<stdio.h>
#include<conio.h>
struct Staff {
clrscr();
char sname[20];
int salary; };
struct Staff st[5];
int i,j;
void getdata()
{
for(i = 0;i<3;i++) {
printf(“\nEnter %dst Staff record,”I + 1);
printf(“\n Staff name\t”);
scanf(“%s,”st[i].sname);
printf(“\nEnter Staff salary\t”);
scanf(“%d,”&st[i].salary); }
printf(“\nDisplaying Staff record”);
for(i = 0;i<3;i++) {
printf(“\nStaff name is %s,”st[i].sname);
printf(“\nSalary is %d,”st[i].salary); }
28 Data Structures with C Programming

}
void main()
{
clrscr ();
getdata();
getch();
}
The output of the program is given in Figure 1.20.

Figure 1.20: Output of an Array of Structure.

1.8. DYNAMIC MEMORY ALLOCATION IN DATA


STRUCTURE
Before learning Dynamic memory allocation, we understand the difference
between static memory allocation and dynamic memory allocation.
S.N. Static Memory Allocation Dynamic Memory Allocation
1. Memory is allocated at compile time. Memory is allocated at runtime.
Data Structures 29

2. Memory can’t be increased while Memory can be increased while


executing the program. executing the program.

3. Used an array. Used in the linked list.

Dynamic memory allocation allows your program to get more memory


space while running, or to free it if it’s not essential. Dynamic memory
allocation function allows you to manually handle the memory space in your
program. In the C programming language is feasible by four functions that
using stdlib.h header file.
• malloc(): Allocates the requested size of memory and returns a
pointer first byte of memory.
• calloc(): Allocates multiple blocks of requested memory space
for array elements, initializes to zero and then returns a pointer
to memory.
• realloc(): Reallocate earlier allocated space by malloc() or
calloc() functions.
• free(): free the earlier allocated space.

1.8.1. Define Dynamic Memory Allocation Function


1. malloc() Function : malloc stands for “memory allocation.” The
size can be obtained of any data by size of() operator. The malloc
() function keep a block of memory a particular size and return a
pointer of type void which can be typecast into a pointer of any
form. It returns NULL if memory is not sufficient for allocation.
Syntax: Pointer = (datatype_cast*) malloc(byte-size);
Example: ptr = (int*) malloc(50 * size of(int));
This statement will allocate either 100 or 200 according to the size of
int 2 or 4 bytes respectively and the pointer points to the address of the first
byte of memory.
2. free() function: allocated memory that is created by either
calloc() or malloc() function doesn’t get freed on its own. You
must use free() function to release the space.
Syntax: free(pointer_variable)
Example: free(ptr); This statement frees the space allocated in
the memory pointed by ptr.
30 Data Structures with C Programming

Program 1.10: Use of malloc() and free()


#include <stdio.h>
#include <stdlib.h>
#include<conio.h>
void main()
{ clrscr();
int n, i, *ptr, sum = 0;
printf(“Enter number of elements: “);
scanf(“%d,” &n);
ptr = (int*) malloc(n * sizeof(int)); //memory allocated using malloc
printf(“\nallocated memory is: %u,”ptr);
if(ptr = = NULL)
{ printf(“Error! memory not allocated.”);
exit(0); }
printf(“\nEnter elements of array:\n “);
for(i = 0; i < n; ++i) {
scanf(“%d,”ptr + i);
sum + = *(ptr + i); }
printf(“Sum = %d,” sum);
free(ptr);
printf(“\nfree of allocated memory is: %u,”ptr);
getch(); }
The output of the program is given in Figure 1.21.

Figure 1.21: Output of malloc and free function.


3. calloc()function: calloc stands for “contiguous allocation.” The
only difference between malloc() and calloc() function is that,
malloc() allocates single block of memory whereas calloc()
allocates multiple blocks of memory each of same size and sets
Random documents with unrelated
content Scribd suggests to you:
Harvard Club of Chicago: “I stood outside of party,” he then said, “for
nearly twenty-five years, and I was perfectly happy, I assure you.... Party
organization, no doubt, is a very convenient thing, but a great many people,
and I feel very strongly with them, feel that when loyalty to party means
worse disloyalty to conscience, it is then asking more than any good man or
any good citizen ought to concede.”
Upon his return from Chicago Lowell gave six lectures on the Old
Dramatists before the Lowell Institute. Though in accepting the invitation
he was returning to an early love he had never forsaken, the preparation was
a burden. “I haven’t time for a word more,” he wrote to Mr. Gilder, 3
March, 1887, “for I begin a course of lectures next Tuesday and haven’t yet
begun to write them, though I have done a deil o’ thinking,” and to Mr.
Higginson on 8 March: “I am fagged to death. I never ought to have
consented to the Lowell Lectures. If I get over them without breaking
down, I shall be happy. After they are (if I am not) over, I will try to do
what you ask. But my brains are husks just now.” Perhaps there was no
better barometer of Lowell’s spirits than his temper regarding out of door
life. Time was when the frosty winter air was elixir to him, but now he
writes: “It is growing colder as my legs inform me—for I have had no fire
to-day. I look out of window and see that the sun is gone behind a cloud,
and the white lines of snow along the walls marking out the landscape as if
for a tennis-court of Anakim. I don’t like winter so well as I used. It tempts
the rheumatism out of all its ambushes, as the sun thaws out snakes. And
the walking is like bad verses.” The confession gains force when one
considers that all his life Lowell had been indifferent to the need of a top
coat, and preferred to work in his study at a temperature of 60°.
In his first lecture Lowell said that he should have preferred to entitle his
course “Readings from the Old English Dramatists with illustrative
comments,” and that is practically what he made of his work. The slim
volume in which, after his death, the six lectures were contained, does not
at all stand for six hours’ entertainment of his audience; long passages
which he read from printed books do not appear at all, as there were no
passages in his written lectures which introduced or followed them. Lowell
was recurring to a familiar theme, and his intention plainly was to speak
freely out of a full mind. He does not appear to have re-read his early
“Conversations;” he had not seen it, he said, for many years, and he was not
quite sure just what its subjects were. A comparison of the two treatments
separated by forty-four years shows curious likenesses and differences. As
will be remembered, the young critic was so zealous over his ideas of
reform that Chapman and Ford, the only dramatists he treated, and Chaucer,
were often no more than mere prompters in the discussion of some current
phase of morals or society. A little of this disposition to vagrancy reappears
in these later talks, for they are quite as informal in their way as were the
earlier Conversations. But in place of the topics connected with reform,
there are more cognate themes. Since he is to speak of Marlowe, he finds it
easy to make, by way of preface, an enquiry into the refinement which had
been going on in the language, and so, by natural association, to one of his
old themes, the sanctity of the English tongue. In introducing Webster also,
he has some quiet criticism on the function of Form; and when he passes to
Chapman, an enquiry into the personal element in literature leads him into
some remarks on biographies, autobiographies, and the modern zest for
intimacies in the lives of men, remarks which gain some earnestness, no
doubt, from experiences which he had undergone.
But for the most part, he keeps closely to his business of inviting his
hearers to share with him the enjoyment of the dramatists whom he reads
and comments on, and when we compare the actual appreciation and
criticism in the two books, the difference is mainly in the mellowness and
quiet assurance which pervade the later treatment, and in the fact that in the
earlier book he was more concerned with what in old-fashioned terms were
the “beauties” of the poets, in the later, with the art and the constructive
faculty.
In his half-homeless condition, Lowell looked with eagerness to his
summers in England. There he had in its leisurely form the social life which
had come to be a real solace to him, and there too he found the world
arranged for the ease and comfort of a solitary. He sailed for England this
year on the 21st of April, and found himself shortly in his familiar lodgings
in London. He liked the sense of world activity which he felt in the heart of
that great city. “Nothing can be more bewildering,” he wrote to his
daughter, “than the sudden change in my habits and surroundings. Were it
merely from the dumbness of Southborough to the clatter and chatter of
London, it would be queer enough; from the rising and falling murmur of
the mill to this roar of the human torrent. But I can hardly help laughing
sometimes when I think how a single step from my hermitage takes me into
Babylon. Meanwhile it amuses and interests me. My own vitality seems to
reënforce itself as if by some unconscious transfusion of the blood from
these ever-throbbing arteries of life into my own.”[99]
There were two places in England, outside of London, in which he
especially delighted: one was St. Ives in Cornwall, the resort of his friends
Mr. and Mrs. Leslie Stephen, the other was Whitby in Yorkshire. For six
years, with the exception of 1885, he had made a summer stay in Whitby. It
was then a quiet, primitive place; now it knows the flood of summer
excursionists. Lowell liked the folk he met there, who reminded him of
New England country folk. He liked the walks in the neighborhood and the
sounding sea, and he was wont to invite to his lodgings friends whose
companionship he cared for. An appreciative follower in Lowell’s footsteps
has made an agreeable record of the memories he left behind in Whitby,
especially with the two Misses Gallillee, with whom he lodged.[100] The
paper deals with the picturesque properties of the little village, and has also
a faint fragrance from the very human reminiscences of Lowell that
remained in the minds of those who came near to him. “In the eyes of the
positive little person—an innate Yankee of Yorkshire blood—whose duty it
was to change the courses on these occasions, literary men as such have no
glamour at all. Her acquaintance includes a number, and her North Country
vocabulary has terms wherewith to dispose of them briefly. But there is
neither reservation nor qualification in the tone in which she says of the
conclusion of a certain discussion, listened to between times in the serving,
‘I never forgot it.’ It had wound up in a round-robin agreement, according
to which each person present was to say by what he should best like to be
remembered. The host spoke last, and the sentence in which his admiring
hearer puts him on record is, ‘By kindly acts and helpful deeds.’ ”
Yet much at home as he was in Whitby, Lowell could not well resist the
contagion which attacks all summer wanderers. As he wrote to Lady
Lyttleton from Whitby, 7 September: “I am a bird of passage now, and that
makes me feel unsettled wherever I am, but I have enjoyed my stay here,
and the hogsheads of fresh air I have drunk have done me good.... I go
down to Somersetshire on Saturday to Mr. Hobhouse, who has promised to
show me Wells Cathedral, the only one in England I have not seen. Thence
I go to the Stephens.” During this summer he was fitfully engaged in
bringing together such poems as he had written since the volume “Under
the Willows,” or had written before but had not included in that volume,
and he continued his work upon it after his return to Deerfoot Farm in the
fall. He pondered over what he should include, what leave out, and the
medley which resulted caused him, in the volume “Heartsease and Rue,” to
distribute the contents without regard to chronology under a variety of
headings,—Friendship, Sentiment, Fancy, Humor and Satire, Epigrams.
“My book will be a raft manned by the press-gang, I fear,” he wrote. “There
will be some hitherto unprinted things in it—many of them trifles—some of
which, however, please my fancy and may another’s here and there.” As he
went on with the work of collection, he grew more and more distrustful. “I
feel,” he wrote 22 December, 1887, “like a young author at his first venture.
I think there will be some nice things in the book, but fear that my kind of
thing is a little old-fashioned. People want sensation rather than sense
nowadays.” Again, 4 January, 1888, he writes: “I am wondering more and
more if my poems are good for anything after all. They are old-fashioned in
their simplicity and straightforwardness of style,—and everybody writes so
plaguily well nowadays. I fear that I left off my diet of bee bread too long
and have written too much prose. A poet shouldn’t be, nay, he can’t be
anything else without loss to him as poet, however much he may gain as
man.”
Yet he liked the little task of collecting the volume, and there was a
pleasurable content in his uneventful country life with his books and pipe.
“My mind is busy,” he wrote, “and I like it. I am sitting in the sun without
fire and I like that. My pipe tastes good and I like that too, for it enables me
to treat with indifference some alarums and incursions of the gout which I
was sharply aware of yesterday and this morning. No weather-sign is so
truthful as this: If your pipe is savory, nothing is the matter with you. Put
that in your pipe and smoke it!”
Lowell’s friendliness showed itself in the informal visits he liked to
make to his friends when he was in town, and the familiar letters he wrote
from the country. He was rather more ready to entertain a correspondent
with a bit of criticism than to heed the calls made on him by editors for the
same kind of writing done with formal purpose. Thus he writes to Mrs. Bell
from Deerfoot Farm, Thanksgiving Day, 1887: “A second-rate author two
hundred years old has a great advantage over his juniors of our own day. If
he himself have not the merit of originality, his language has that of
quaintness which sometimes gives him a charm similar in its effect though
very inferior in quality. I think this is true of Feltham, though it be now
more than twenty years since I have looked into him. I had read him in the
day of my superstition when one takes all established reputations for
granted, and read him over again after Experience had let fall her fatal
clarifying drops into my eyes. Woe’s me, how he has dwarfed! I wrote my
opinion of him on the flyleaf of my little quarto edition, and all I can
recollect of him is that I called his style ‘lousy with Latinisms.’ Pardon me.
Swift was still read when I was young, and how resist the alliteration? I can
pardon Browne’s Latinisms, nay, his Græcisms too, and even like them.
They are resolved in the powerful menstruum of his thought. They are
farsought and yet seem not farfetched. Feltham’s are stuck-in like plums in
his poor pudding and make the dough more dismal by contrast. He hasn’t
stoned them and we crush between our teeth something hard and out of
place that leaves an acrid taste behind it. I remember one phrase of his that
tickled me—the ‘spacious ears’ of the elephant. It fits another animal, and
sometimes when I have been assfixiated by an audience I have been
tempted to beg of them to ‘lend me their spacious ears.’
“I think it possible that I gave Longfellow the references to him, for I
was reading him about the time the Dante translation was going on. I could
tell if I had my copy here and could take a look at the flyleaves.
“I may do Feltham wrong. The navicella di nostro ingenio draws more
water as we grow older, and grounds in the shallows where we found good
water-fowling in our youth.
“No doubt the book is in the Athenæum,—but wait, please, till I can lend
you my copy. It is at Elmwood, and I can get it after I come back from New
York, whither I go to be baited for the benefit of the International Copyright
League. I wish there were a concise and elegant Latinism for D—n! I would
bring it in gracefully here.
“I didn’t mean to write all this and shouldn’t if I hadn’t had something
else I ought to be doing. How tempting the duty that lies farthest from us
always is, to be sure!”
It may have struck the reader how little comment, comparatively, Lowell
made during his life upon his fellows in American literature. We must
except of course his poetic criticism in “A Fable for Critics” and “Agassiz;”
but in his prose criticism he occupied himself most constantly with the
dead, not the living. When, later, he spoke on “Our Literature” at the
Washington Centennial in New York he confined himself to generalities. It
is worth noting, therefore, that on an occasion when he was called on to
preside at an Authors’ Reading for the benefit of the Copyright League[101]
he prefaced his argument for an international copyright act with a résumé of
the course of American literature, and some more specific characterization
of the contemporaries with whom his own name always will be associated.
As a somewhat unwonted personal sketch, even though scarcely more than
an off-hand deliverance, it may well be given here as one of the last of
Lowell’s public addresses.
“When I was beginning life, as it is called,—as if we were not always
beginning it!—the question ‘Who reads an American book?’ still roused in
the not too numerous cultivated class among us a feeling of resentful but
helpless anger. The pens of our periodical writers fairly sputtered with rage,
and many a hardly suppressed imprecation might be read between their
lines. Their position was, in truth, somewhat difficult. We had had Jonathan
Edwards, no doubt; and people were still living who thought Barlow’s
‘Hasty Pudding’ a lightsome jeu d’esprit, and who believed that Dwight’s
‘Conquest of Canaan’ was a long stride towards that of posterity and the
conversion of the heathen there. We had had Freneau, who wrote a single
line,—

‘The hunter and the deer a shade,’

which had charmed the ear and cheated the memory of Scott (I think it was)
till he mistook it for his own. We had the ‘Star Spangled Banner,’ and two
or three naval ballads which, to my ear, have the true rough and ready tone.
Philip Cook, of Virginia, had written a few graceful and musical lyrics. We
had ‘McFingal,’ as near its model as any imitation of the inimitable can be,
but far indeed from that intricate subtlety of wit which makes ‘Hudibras’ a
metaphysical study as well as an intellectual delight. We had in the
‘Federalist’ a mine of political wisdom by which even Burke might have
profited, and whose golden veins are not yet exhausted, as foreign statists
and jurists are beginning to discover. But of true literature we had next to
nothing. Of what we had, Duyckinck’s scholarly ‘Cyclopædia of American
Literature’ gives us an almost too satisfactory notion. Of what we had not,
there was none to tell us, for there were no critics. We had no national unity,
and therefore no national consciousness, and it is one of the first conditions
of a virile and characteristic literature that it should feel solid and familiar
earth under its feet. New England had indeed a kind of unity, but it was a
provincial unity, and those hardy commonwealths that invented democracy
were not and could not yet be quite in sympathy with the new America that
was to adopt and expand it. Literature thrives in an air laden with tradition,
in a soil ripe with immemorial culture, in the temperature, steady and
stimulating, of historic associations. We had none of these. What semblance
we had of them was English, and we long continued to bring earth from the
mother-country to pot our imported plants with, as the crusaders brought
home that of Palestine to be buried in. And all this time our native oak was
dropping its unheeded acorns into the crannies of the rock where by and by
their sturdy roots would make room for themselves and find fitting
nourishment.
“Never was young nation on its way to seek its fortune so dumfounded
as Brother Jonathan when John Bull, presenting what seemed to his startled
eyes a blunderbuss, cried gruffly from the roadside, ‘Stand, and deliver a
literature!’ He was in a ‘pretty fix,’ as he himself would have called it. After
fumbling in all his pockets, he was obliged to confess that he hadn’t one
about him at the moment, but vowed that he had left a beautiful one at
home which he would have fetched along—only it was so everlasting
heavy. If he had but known it, he carried with him the pledge of what he
was seeking in that vernacular phrase ‘fix,’ which showed that he could
invent a new word for a new need without asking leave of anybody.
“Meanwhile the answer to Sydney Smith’s scornful question was
shaping itself. Already we had Irving, who after humorously satirizing the
poverty of our annals in his ‘Knickerbocker,’ forced to feel the pensive
beauty of what is ancient by the painful absence of it, first tried to create an
artificial antiquity as a substitute, and then sought in the old world a
kindlier atmosphere and themes more sympathetic with the dainty and
carefully shaded phrase he loved. He first taught us the everliving charm of
style, most invaluable and most difficult of lessons. Almost wholly English,
he is yet our earliest classic, still loved in the Old Home and the New. Then
came Cooper, our first radically American author, with the defects of style
that come of half-culture, but a man of robust genius who, after a false start,
looked about him to recognize in the New Man of the New World an
unhackneyed and unconventional subject for Art. Brockden Brown had
shown vivid glimpses of genius, but of a genius haunted by the phantasms
of imagination and conscious of those substantial realities they mocked
only as an opium eater might be. His models were lay figures shabby from
their long service in the studios of Godwin and the Germans. Cooper first
studied from the life, and it was the homo Americanus with our own
limestone in his bones, our own iron in his blood, that sat to him. There had
been pioneers before him, like Belknap and Breckenridge, who had, in
woodman’s phrase, blazed the way for him, but he found new figures in the
forest, autochthonous figures, and on the ocean, whose romance he was the
first to divine, he touched a nerve of patriotic pride that still vibrates. I open
upon my boyhood when I chance on a page of his best. In prose we had also
Channing, who uttered the perceptions, at once delicate and penetrating like
root fibres, of a singularly intuitive mind in a diction of sober fervor where
the artist sometimes elbows aside the preacher; and Webster, the massive
simplicity of whose language and the unwavering force of whose argument,
flashing into eloquent flame as it heated, recalled to those who listened and
saw before them one of the most august shapes manhood ever put on, no
inadequate image of Pericles. We had little more. Emerson was still letting
grow or trying in short flights those wings that were to lift him and us to
Heaven’s sweetest air. Hawthorne, scarce out of his teens, had given in
‘Fanshawe’ some inkling of his instinct for style and of the direction his
maturer genius was to choose, but no glimpse of that creative imagination,
the most original and profound of these latter days. Our masters of
historical narration were yet to come.
“In poetry we were still to seek. Byrant’s ‘Waterfowl’ had begun that
immortal flight that will be followed by many a delighted eye long after
ours shall have been darkened; Dana had written some verses which
showed a velleity for better and sincerer things; Willis was frittering away a
natural and genuine gift; Longfellow was preluding that sweet, pure, and
sympathetic song which persuaded so many Englishmen that he must be a
countrymen of theirs. In his case the question certainly became not ‘Who
reads an American book?’ but ‘Who does not read one?’ Holmes had
written one imperishable poem.
“This was the state of things when I was a boy. That old question, once
so cruelly irritating, because it was so cruelly to the point, has long ago lost
its sting. When I look round me on this platform, I see a company of
authors whose books are read wherever English is read, and some whose
books are read in languages that are other than their own. The American
who lounges over an English railway-book-stall while his train is making-
up sees almost as many volumes with names of his countrymen on their
backs as he sees of native authors. American Literature has asserted and
made good its claim to a definite place in the world. Sixty years ago there
were only two American authors, Irving and Cooper, who could have lived
by their literary incomes, and they fortunately had other sources of revenue.
There are now scores who find in letters a handsome estate. Our literature
has developed itself out of English literature, as our political forms have
developed themselves out of English political forms, but with a difference.
Not as parasitic plants fed from the parent stock, but only as new growths
from seeds the mother tree has dropped, could they have prospered as they
have done. And so our literature is a part of English literature and must
always continue to be so, but, as I have said, with a difference. What that
difference is, it would be very hard to define, though it be something of
which we are very sensible when we read an American book. We are, I
think, especially sensible of it in the biography of any of our countrymen, as
I could not help feeling as I read that admirable one of Emerson by Mr.
Cabot. There was nothing English in the conditions which shaped the earlier
part of Emerson’s life. Something Scottish there was, it may be said, but the
later life at Concord which was so beautiful in its noble simplicity, in its
frugality never parsimonious, and practised to secure not wealth but
independence, that is—or must we say was?—thoroughly American.
Without pretension, without swagger, with the need of proclaiming itself,
and with no affectation of that commonness which our late politicians seem
to think especially dear to a democracy, it represented whatever was
peculiar and whatever was best in the novel inspirations of our soil. These
inspirations began to make themselves felt early in our history and I think I
find traces of their influence even so long ago as the ‘Simple Cobbler of
Agawam,’ published in 1647. Its author, Ward, had taken his second degree
at Cambridge and was a man past middle life when be came over to
Massachusetts, but I think his book would have been a different book had
he written it in England. This Americanism which is there because we
cannot help it, not put there because it is expected of us, gives, I think, a
new note to our better literature and is what makes it fresh and welcome to
foreign ears. We have developed, if we did not invent, a form of racy,
popular humor, as original as it is possible for anything to be, which has
found ideal utterance through the genius of ‘Mark Twain.’ I confess that I
look upon this general sense of the comic among our people and the ready
wit which condenses it into epigram, as one of the safeguards of our polity.
If it be irreverent it is not superstitious; it has little respect for phrases; and
no nonsense can long look it in the eye without flinching.”

“Heartsease and Rue” was published in the early spring of 1888 and
immediately afterward Lowell printed in the Atlantic his poem “Turner’s
Old Téméraire, under a Figure symbolizing the Church.” This poem and
“How I consulted the Oracle of the Goldfishes,” which appeared in the
Atlantic for August, 1889, were printed in the thin posthumous volume of
“Last Poems,” and belong thus in the group which most effectively
represents Lowell’s mood on the profoundest themes at the end of his life.
The first poem in “Heartsease and Rue,” that on Agassiz, which heads the
section entitled Friendship, has already been noted in connection with the
time when it was written. A little of the same pathos of parting with old
friends is in the postscript of the letter to Curtis, and in this as in the former,
the poet’s mind runs on naturally in its speculation to the new To Be. A
single hint of a thought which filled many of Lowell’s hours occurs in the
poem when he says:—

“With bits of wreck I patch the boat shall bear


Me to that unexhausted Otherwhere;”

but it is in the group of poems referred to above that one sees most clearly a
recurrence to the great underlying questions of faith. With a half-mocking
smile Lowell asks in “Credidimus Jovem regnare” if science has found the
key which religion has lost, and falls back on the somewhat lame
conclusion that he had best keep his key, which may be but a rusty
inheritance, on the chance that the door and lock may some day be made to
fit the key. Again, in the poem “How I consulted the Oracle of the
Goldfishes,” where he muses over the realities and illusions of the spiritual
world, he does not deny the doubts that have arisen in his own mind, but
after all refuses to permit even his doubts to dismay him.
“Here shall my resolution be:
The shadow of the mystery
Is haply wholesomer for eyes
That cheat us to be over-wise,
And I am happy in my sight
To love God’s darkness as His light.”

Nor will he allow himself, even when contemplating what he regards as the
obscuration of the Church’s light, to look upon this as the last state of
organic faith. He takes that noble painting by Turner, “The Fighting
Téméraire tugged to her last berth, to be broken up,” and sees science, “a
black demon, belching fire and steam,” drag it away “to gather weeds in the
regardless stream.” Ruskin makes the picture an unconscious expression by
the painter of his own return to die by the shore of the Thames, “the cold
mists gathering over his strength, and all men crying out against him, and
dragging the old ‘Fighting Téméraire’ out of their way, with dim, fuliginous
contumely;” but surely this is rather the passionate comment of a disciple
making his master’s work prophetic. Lowell’s poem strikes a deeper than a
personal note. It is a fine imaginative conception, a rare interpretation of a
great work of art by another work of art, and what is noticeable in the cry of
the poem is the protest which Lowell, in his instinctive faith, makes against
the finality of his own interpretation. He sees in imagination the splendid
history of the church, and no fighter under Nelson could have witnessed this
desolate funeral of the great ship with more anguish than Lowell has thrown
into his pathetic words; but as the English sailor could have righted himself
with a vision of the glories of the future English navy, so Lowell closes his
dirge with a triumphant prophecy:—
“Shall nevermore, engendered of thy fame,
A new sea-eagle heir thy conqueror name,
And with commissioned talons wrench
From thy supplanter’s grimy clench
His sheath of steel, his wings of smoke and flame?

“This shall the pleased eyes of our children see;


For this the stars of God long even as we;
Earth listens for his wings; the Fates
Expectant lean; Faith cross-propt waits,
And the tired waves of Thought’s insurgent sea.”[102]

In taking another great painting as the prompter of his verse, Titian’s so-
called “Sacred and Profane Love,” Lowell again is not so much interpreting
the painter’s thought as he is using the canvas for a mirror in which to read
his own soul, and though in printing “Endymion” he adds the gloss “a
mystical comment,” one may guess that Lowell in this twilight of his life,
musing upon the ideals which had beckoned him from earliest days, still
saw in the heavens that vision of beauty, of truth, and of freedom which had
never been dethroned in his soul. Faithfulness to high emprise,—that at
least he could declare of himself amidst all the doubt that beclouded his
intellectual vision, and it was fitting that the poet should, in this veiled
figure of Endymion, see the reflection of his own face and form.
In sending “Endymion” to his publishers for insertion in the volume
“Heartsease and Rue,” Lowell had written from Deerfoot Farm, 20
December, 1887: “I hoped to have sent this [‘Endymion’] by Monday
morning’s post, but for two days after my return my head continued to be
cloggy and my vein wouldn’t flow. I have at last managed to give what
seems to me as much consecutiveness as they need to what have been a
heap of fragments in my note-books for years. Longer revolution in my
head might round it better, but take it as a meteorolite, splintery still, but
with some metallic iridescence here and there brought from some volcanic
star. Let it come among poems of sentiment, and as the longest, first if
possible.”
He was still looking forward at this time to full labors. He had been
urged by his publishers to undertake the volume on Hawthorne in the
American Men of Letters series. He had signified his assent in general,
some time before, and seemed now to be deliberately contemplating the
task, for he wrote four days after the last:—
“I think there have been one or two volumes published within a few
years about old Salem. I should be glad to have them sent to me at
Southborough. I have one little job of writing to finish, after which I shall
revise my poems and prose for a new edition. I don’t know whether it be
second childhood, but I am beginning to take an interest in them. Then I
mean to take up Hawthorne in earnest....”
Before “Heartsease and Rue” was published Lowell had begun the task
of setting in order all his writings. With some hesitation he published in the
spring of 1888 a volume of “Political Essays,” in which he gathered the
articles printed in the Atlantic and North American Review during the
stormy war period, but he added as the final number his address on “The
Independent in Politics,” given in New York, 13 April, 1888. It may be
noted that, with no apparent definiteness of purpose, Lowell did in the
closing years of his life sum up, in forms which occasions for the most part
suggested, his leading principles and doctrines, as if in a series of
valedictories. Thus “Democracy” was a confession of his fundamental
belief in the region of world-politics; his address at Harvard was the one
word on scholarship which at the end of a scholar’s life he most wished to
say; his address before the Copyright League had touched on points in the
great theme of literature which had been of lifelong interest; in his serious
poetry, as we have seen, he touched upon those great themes of both worlds
which, as a seer of visions all his life, he could not fail to find deepening in
his thought; and now he took the opportunity furnished by a friendly
audience to set forth some of those principles which had formed his rule of
conduct throughout a life that had found active employment in citizenship.
There is no lack of definiteness in this address, and yet the period just
before its delivery, when he may be supposed to have prepared it, was one
of even unwonted depression.
“It isn’t pleasant to think one’s self a failure at seventy,” he wrote 27
March, 1888, “and yet that’s the way it looks to me most of the time. I can’t
do my best. That’s the very torment of it. Why not reconcile one’s self with
being second-rate? Isn’t it better than nothing? No, ’tis being nowhere.”
And on being expostulated with, he wrote again: “It isn’t the praise I care
for (though of course I should like it as well as Milton did, I suppose),—I
mean the praise of others,—but what I miss is a comfortable feeling of
merit in myself. I have never even opened my new book since it was
published—I haven’t dared.”
It would be idle to seek too narrowly for the causes of this despondency.
As we have had frequent occasion to note, Lowell all his life was subject to
fluctuation of moods. The most comprehensive cause was no doubt in the
very constitution of his temperament, and as he was overclouded at times,
so for him the sun when it shone was more brilliant than to many. But one
asks most anxiously, are such moods superficial or do they trench upon the
very citadel of being, sapping and mining the walls, so that if entrance is
made, the very heart stops beating. In all the shifting of Lowell’s mind there
were great fundamental beliefs from which he would not be separated. It
may be that in those deepest laid foundations of being, where the bed-rock
of faith in spiritual realities is discovered to be a ledge of the rock of ages,
Lowell finally, as we have seen, confessed to an ultimate expression of
faith, which was that of a child in the dark; but how was it as regards that
firm belief in his country which had been a passion with him all his days,
and was in truth an elemental faith with him? It is hard to read his last
political discourse, “The Place of the Independent in Politics,” without a
little sense of pain mingled with one’s admiration for the serenity of the
temper with which Lowell made what was in effect a confession of his
political faith; for when one comes to rest his hopes for his country in the
remnant, he confesses almost to as much doubt as confidence. It must of
course be remembered that Lowell had given expression to his large faith in
democracy in his Birmingham address, and he calls the attention of his
audience to this as an explanation of the terms in which he is to address his
own countrymen. He might properly use a note of warning among a people
whose cardinal doctrine was the democratic principle, and he was justified
unquestionably in giving frankly his impressions of the low point to which
political organizations had fallen. Still, in undertaking to account for the
evolution of the democratic idea in American life, he was questioning
whether after all opportunity had not much to do with it, and whether now
that the walls were closing about this new country, the force of evolution
had not been largely spent. The dangers imminent in the constant inflow of
an ignorant body of foreigners, in the easy good-nature with which the
American tolerated abuses, and in the aristocratic character of a civil
service as diseased as the rotten borough of English politics,—these dangers
rose before him, threatening, alarming. He had lost faith largely in the
organic action of parties, chiefly because he saw in them the passive
instruments of unscrupulous politicians; and he found the correction of this
great evil in the increasing power of a neutral body. He even went so far as
to find the only hope of salvation in the action of the Independents. “If the
attempt should fail,” the attempt that is to reform the parties from without,
“the failure of the experiment of democracy would inevitably follow.”
This is not the place to discuss the merits of such a question. What I wish
is to show the working of Lowell’s mind on those political subjects which
had occupied him from boyhood. He was consistent throughout in holding
lightly to any allegiance to party, and in valuing highly the integrity of the
individual conscience, and his plea, gathering force as it proceeds, is for
such a spirit of devotion to the great ideals of the country as shall compel
the union of like-minded patriots in accomplishing the great active reforms
that press upon the minds of thoughtful men.
“What we want,” he says in conclusion, “is an active class who will
insist in season and out of season that we shall have a country ... whose
very name shall not only, as now it does, stir us as with the sound of a
trumpet, but shall call out all that is best within us by offering us the radiant
image of something better and nobler and more enduring than we, of
something that shall fulfil our own thwarted aspiration, when we are but a
handful of forgotten dust in the soil trodden by a race whom we shall have
helped to make more worthy of their inheritance than we ourselves had the
power, I might almost say the means, to be.”
No, Lowell’s last word to his countrymen in domestic politics was not
one of despair, however it may have been tinged with a sense of temporary
defeat. It was because of his strong love that he was jealous of the honor of
his country. The sadness is that of one weary in the fight, but the last note,
as in the other instances of his valedictories, was a call to action and the
reassertion of his undying faith in his country. Yet, as in the other instances,
there is the pathetic note of faith in spite of the evidence of sight.
Once again, a little later than this, he was called on to preside at a dinner
of the Civil Service Reform Association, and something of what he then
said may be quoted as showing how hope and courage came to the front
with him when great national issues were in question. “If I am sometimes
inclined to fancy,” he then said, “as old men will, that the world I see about
me is not so pleasant as that on which my eyes first opened, yet I am bound
to admit on cross-examining myself, that it is on the whole a better world,
better especially in the wider distribution of the civilized and civilizing
elements which compose it, better for the increased demands made upon it
by those who were once dumb and helpless and for their increasing power
to enforce those demands. But every advance in the right direction which I
have witnessed has seemed painfully slow. And painfully slow it was, if
measured, as we are apt to measure, by the standard of our own little lives,
and not, as we should, by that larger life of the community which can afford
to wait.
“Every reform like that in which we are interested has to contend with
vested interests, and of all vested interests abuses are those which are most
adroit in putting a specious gloss on their monopolies and most
unscrupulous as to the weapons to be used in their defence. The evil system
which we would fain replace with a better has gone on so long that it almost
seems part of the order of nature. It is a barbarous and dangerous system.
When I was in Spain I saw reason to think that the decay of that noble
nation, due, no doubt, to many causes, was due above all to a Civil Service
like our own that had gone farther on the inevitable road which ours is
going.
“It should seem that a reform like ours, so reasonable, so convenient, so
economical, would at once commend itself to the good sense of the people.
And I think there are manifest signs that it is more and more so
commending itself. The humanity of our day is willing (as our ancestors
were not) that the state should support its inefficient members. But did
humorist ever conceive a more wasteful way of supporting them than by
paying them salaries for performing ill the minor and more mechanical
functions of government, thus making this inefficiency costly to every one
of us in his daily affairs? Even supposing them capable of becoming
efficient, the chances are that, just when they have learned their business,
they will be dismissed to make room for other apprentices to pass through
the same routine. My own experience has convinced me that not only our
social credit, but our business interests have suffered greatly by the theory
still more or less prevalent that a man good for nothing else was just the
thing for one of the smaller foreign consulates.”
CHAPTER XVII

THE LAST YEARS

1888-1891

Lowell went again to England in the spring of 1888, and in June to


Bologna, where he was a delegate from Harvard on the occasion of the
celebration of the eight hundredth anniversary of the foundation of the
University. He received from Bologna the degree of Doctor of Letters. He
left London for the continent on Saturday the 9th of June and was back in a
week. He had a most uncomfortable experience, being attacked severely by
the enemy which now seemed to be always lying in wait for him. He gave
an outline of his discomfiture in a letter written to Mr. Norton three weeks
after his return to London.
“My gout began in Bologna. It announced itself on Tuesday by an illness
which prevented me from venturing out, and so a very pretty speech in
Italian which I had in my head remained there to the great loss of mankind.
Doctor Weir Mitchell[103] came to me at once on hearing of my disorder, so
that I was able to be out next day to receive my degree with the rest. As I
walked home from the ceremony I found myself very lame and foreboded
what was coming to pass. I got off with Story to Milan by the train leaving
Bologna at 1 A.M. I spent Thursday in Milan, where I provided myself with
felt slippers, and next day started for London to escape being ill in an Italian
inn. I got through the thirty-one hours’ journey fairly well with the help of
the Glasgow delegates Ramsay and Ferguson, who helped me in every way.
I don’t think my journey did me any harm. By the time I reached Calais on
Saturday I was able to get on my boot again and thought I had got over the
worst, but next day I had to resign myself to my sofa, and for ten days was
in intense pain. The whole foot in every joint and the ankle were inflamed.
For three days the other foot (in the toe joint only) took sides with its mate,
and I was discouraged. This, however, passed off, and last Thursday [5
July] I was able to be dressed. To-day I have my boots on, though stropeato.
Ecce tutte.”
He was in Whitby again in August, living as he liked so well now to do
with his books and letters and few friends and the walks which were little
more than easy strolls. He wrote to his friend Mrs. Leslie Stephen who was
at St. Ives in Cornwall: “I am still pretty lame (do you know I begin to think
that I am really seventy at last, and not playing that I am) and can take only
short walks. But I hope that the air here will gradually blow the years out of
me again. And the fish diet, too, a far more invigorating animal here than in
your sleepy Southern waters which have done nothing but sun themselves
and doze since Sir Cloudesley Shovel’s days. What are your pilchards when
you contrive to catch ’em, and your gurnards (of which latter indeed
nothing is left but a petrified head fit only for the table of a geologist that
ever I heard of) to our cod and whiting and ling, to speak of no others, with
their flesh hardened by constant struggle with our cold Northern waters?
Why, your poor fellows have to come all the way hither to catch even a
herring, while we have them fresh from the sea every morning. I wish I
could send you a few as we know them. And where is your Abbey? We are
under the special protection of B. V. Sanctæ Hildæ with the added flavor in
our prayers that she was a king’s daughter and therefore of our set, and with
that sympathy for our special infirmities that comes of knowledge. If you
have any saint ’tis some fellow with a name you can’t pronounce, and who
understands nothing but Cornish, whereas Hilda spoke English, as Freeman
has proved over and over again.”
To Mr. Norton, who had been advising with him on some points in the
translation of Dante, he wrote from Whitby: “You put me some pretty stiff
conundrums, but I will try.... The swoon at the end of the canto (Inferno III.)
is a nut too hard for my hammer. I have turned it and tapped it on every
corner that seemed hopeful without making so much as a crack in it.
Tambernic and Pietrapana might fall on it in vain. I must have expressed
myself clumsily in my last letter. I did not mean to counsel paraphrase in
the text, but at foot of page for the help of the Philistine to whom all poetry
is a dead language. At best the translation of a poem is a waxen image of
the living original, and being too literal is to dress it in the very clothes it
wore as if the reality were in them.
“I do not know whether I told you that my last attack of gout had left me
more infirm than ever before. I am still lame in both feet, though I insist on
walking in the hope of getting limber and because without exercise I can’t
sleep. We have had disastrous weather here, a cold of Antenora, with fierce
winds to drive it in. Even the stones of the Abbey seem to feel it and
shudder. I am sitting by a fire as I write. For the first time I begin to think
myself capable of growing old.[104]
“I am in the same lodgings as last year, which is a pleasure to me, with
kind, simple people, who do all they can to make me happy. They are very
like our New England country folk, except in accent, almost the same thing
in fact.”
In this letter Lowell intimates one of the physical ills that were attacking
him, the loss of sleep. One of his friends and admirers, Canon Stubbs, gave
this reminiscence,[105] not long after Lowell’s death. “Some years ago,” he
writes, “I was in the habit of meeting him from time to time at the country
house of a common friend. One especial evening—a ‘golden night of
memory’—I shall never forget. After dinner one of the guests asked Lowell
to read one of his own poems. This request he playfully put aside, but he
began to talk to us about Wordsworth, and read to us part of the
‘Laodamia,’ commenting, as he read, much I confess to my surprise, on the
narrowness and limited experience of Wordsworth, and the one-sided
development of his intellectual powers. Then some chance expression
turned the current of his talk, and he began describing, with all the quaint
humor and delightful raillery of which he was so complete a master, a
special antidote to sleeplessness which he said he had himself lately
devised,—the invention of new chapters in Cæsar’s Commentaries on the
Gallic War. I wish I could remember the chapter which he then recited. The
aptness of the Latin phraseology was irresistibly funny. It told ‘how
Vercingetorix and his army, retreating before Cæsar, had taken refuge on a
high, rocky hill, strongly fortified and precipitous on every side, from
which at first Cæsar had despaired of dislodging him without a long siege.
But while Cæsar was considering these things an opportunity of acting
successfully seemed to offer. He noticed a fissure in the rock, which on
investigation by night was discovered to pierce the hill from side to side.
[Here we expected the anachronism of dynamite or gunpowder. But no;
Lowell more justly appreciated the natural genius of Cæsar.] Knowing that
the winter was now nigh at hand, Cæsar ordered two legions of soldiers to
block up with clay and twisted willow work the opposite ends of the rocky
cleft, and then, having filled the chasm with water, to await the issue. That
night the frost came; the water expanded; the high rock was cleft asunder;
and down came Vercingetorix and his army. For this success’—Lowell
concluded—‘a supplication of twenty days was decreed by the Senate upon
receiving Cæsar’s letter.’ ”
After a visit to St. Ives, Lowell returned to London and remained there
till the middle of November. His friends the Misses Lawrence were at
Wildbad. As he never quite finished his couplets to Mrs. Gilder, so he never
quite exhausted the playful names he gave these two ladies. “O Giminy,” he
wrote from London, 1 October “(for I have exhausted all other ways of
expressing your twinship in my affection, and any opening exclamation will
suit the context), O Giminy, I say, how can you be happy in a hotel that
Klumpps with a double p like a man with a club foot, and in a town which,
by its own confession, is both wild and bad? What are you doing there?
Taking the baths? You can’t soak the goodness out of you, if you try never
so hard, that’s one comfort. You ‘admired the traces of the Romans at
Treves’ did you? Pray, did you see the Holy Coat? That is what the place is
famous for, bless your innocent souls. And then your single room at Munich
with ‘2 or 3 Bismarcks, as many Gladstones and Döllingers’ in it. Do you
expect me to believe that? It would have been uninhabitable had there been
only one apiece of them, and you know it. You trifle with my
understanding. Smoky London, indeed! The sky to-day is like a gigantic
blue bell tipped over to pour out the sunshine it cannot contain. And the
town is emptily delightful and one does not see a soul one knows from one
end of the week to t’other. I shouldn’t mind its being fuller by a dozen or so,
my Ambidue among them. Indeed, I was thinking yesterday of writing to
ask where you were and when you were coming back to the lovers who (all
but one of them) make me so jealous. The middle of October seems a great
way off to that single inoffensive one, but ’tis better than nothing. I shall be
here till the middle of November, and you will let me know the moment
you come, won’t you?
“I haven’t the least notion where Wildbad is, and you give no
geographical details, so I don’t feel sure that this will ever reach the Hôtel
Klumpppppp though there can’t be two of that name even in this most
patient of worlds. Did Wagner ever set it to music? Methinks ’twould have
suited his emphatic and somewhat halting genius. But I shall try for a
guide-book, and if this never reaches you, I shall be consoled with thinking
that you will never know how little you have lost.
“I am very well, almost as well as before my gout; but I am rather dull,
as you were just saying to each other. However, your return will brighten
me, and you shall take me to the play and the opera and Madame Tussaud’s
just as often as you please. And I invite myself to dine with you too—I
mean two. Am I not generous? The nearer I get to the end of my sheet (like
a prisoner escaping and doubtful where he was going to drop) the more I
wonder where Wildbad is. I shall ask at a foreign book-shop. That is the
simplest plan, for they are all kept by German Jews who know every place
where Christians are plundered the world over. And if a Bad of any kind
does not come within that definition I am greatly mistaken. My only doubt
would be as to whether you were Christians? Well, you have always treated
me as if you were. Good-by.”
Lowell spent a night at Chester with Mr. Hughes and sailed from
Liverpool 22 November. He spent the winter of 1888-1889 at his sister’s,
Mrs. Putnam’s, in Boston. He found himself physically depressed and
disinclined to any effort. A hasty acceptance of an invitation to lecture in
Philadelphia brought him intolerable discomfort, and he begged to be let
off, if it could be done without prejudice to his hosts. “It is absurd,” he
wrote, “but I was made so. I won’t torment myself by speaking in public
any more. With any such engagement on my mind, I can do nothing else,
and indeed do nothing but think about that.” Dr. Mitchell at once released
him, and Lowell wrote in reply, 27 December, 1888: “I got your welcome
letter last evening, and when I first looked in the glass this morning I was
pleased to find my hair less gray than when I went to bed. You never wrote
a better prescription. My mind has been relieved of what really seemed to
me an intolerable weight, for, whether it be from old age or whatever cause,
I have been undoubtedly inert both in body and mind since my attack of
gout last summer.” On the same day he wrote to Mr. Gilder: “Many thanks
for your welcome home. I am miserably dumpy, thank you, with the
remains of my tedious fit of gout last summer, which continues to hold my
frontier posts as the British did ours after the treaty of 1783. But I hope to
go on to Washington early in February in time to get back for my seventieth
birthday, which I can’t spend in the tents of Kedar.”
Lowell’s visit to Philadelphia and Washington is pleasantly reflected in
his letters. His son-in-law, Mr. Burnett, was at that time a member of the
House of Representatives, and Lowell, though he expressed a fear lest his
lion’s mane should blow off, was entertained agreeably and came away with
an admiration for many of the public men he met. His seventieth birthday
came shortly after his return to Boston, when he was given a dinner at the
Tavern Club over which Mr. Norton presided. “I was listening to my own
praises for two hours last night,” he wrote to Mrs. Fields, “and have hardly
got used to the discovery of how great a man I am.” He heard these praises
again in a more public way when the Critic of New York made its number
for 23 February a “Lowell birthday number,” having collected warm
tributes of affection and admiration from seventy men and women of note
in America and England. By an ingenious alphabetical arrangement the
editor displayed his letters from Y to A, the astronomer Young heading the
list and the poet Aldrich closing it. The English names naturally were fewer
in number, but they included Tennyson and his son, Gladstone, Lord
Coleridge, Lang, Locker-Lampson, and Palgrave; amongst his own
countrymen were those yet his seniors, Holmes, Whittier, Mrs. Stowe, the
elder Furness, and President Barnard, while the poet Parsons born in the
same year and a host of juniors joined in the chorus of loving praise. As Dr.
Horace Howard Furness truly said: “It is no small tribute, in itself, to Mr.
Lowell that we should all be thus ready to praise him to his face.”
Lowell had set the date for his annual pilgrimage to England at 27 April,
but a pressing invitation to speak on the 30th of that month at the great
celebration in New York of the hundredth anniversary of Washington’s
inauguration as first president, which he tried in vain to decline, compelled
him to postpone his departure for nearly a month. Meanwhile he worked
somewhat fitfully at literature, belabored as he was with letters and social
distractions. Mr. Aldrich asked him to write for the Atlantic a paper on John
Bright, who had just died. At first he thought he could write it, but a
fortnight later he wrote: “There is no use in trying. Cold molasses is swift as
a weaver’s shuttle compared with my wits. I have essayed every side of the
subject like a beetle in a tumbler and find myself on my back after each
attempt. So you must let me give it up.” It was characteristic of his
unfailing interest in all genuine literature, new or old, that he should at the
same time have written to Mr. Aldrich his pleasure in a poem, “Deaths in
April,” in the current Atlantic. “Too intricate and even obscure I thought it
here and there, but perhaps the intricacy is of forest-boughs and the
obscurity nothing more than the gloom which they teach light to
counterfeit. Never mind, ’tis the Muses’ utterance.”[106]
The special piece of writing which did occupy him for awhile, an
introduction to Isaak Walton’s “Complete Angler,” may fairly be called one
of the happiest of his literary appreciations. He writes, to be sure, to Dr.
Mitchell that he is “thoroughly fagged” with the work, but to the
unsuspecting reader who comes upon it in the volume of Lowell’s “Latest
Literary Essays and Addresses” there is the sense only of a quieter tone than
he finds in the Gray, for example, in the same volume. There is no lack of
acuteness, rather one is struck with the delicacy of the criticism, but the
special charm is in the delight which Lowell takes in his sunny-tempered
author. It is as if he had been thoroughly fagged when he took Walton down
and as he read the “Lives” and the “Complete Angler” was drawn within the
cheerful mind of Walton and warmed himself at the open fire of his charity.
The paper has the value one finds so often in Lowell’s writings, of
reflecting the writer’s mood, and one who has followed Lowell into the
recesses of his consciousness of age can scarcely fail to bear him company
when he finds him writing of Walton: “But what justifies and ennobles
these lower loves (of music, painting, good ale, and a pipe), what gives him
a special and native aroma like that of Alexander, is that above all he loved
the beauty of holiness and those ways of taking and of spending life that
make it wholesome for ourselves and our fellows. His view of the world is
not of the widest, but it is the Delectable Mountains that bound the
prospect. Never surely was there a more lovable man, nor one to whom love
found access by more avenues of sympathy.”
The after-dinner speech for which Lowell consented to postpone his
summer journey to England was in response to the toast “Our Literature.”
The speech appears as the last piece of literature which Lowell published in
his collected writings, and it is a coincidence that this should stand at the
end of his career, when at the beginning, if we may, not unnaturally, count
The Pioneer as his formal bow in the profession of letters, stood the
announcement of his outlook on national literature. Nearly forty-seven
years lie between the two deliverances. As a young man of twenty-three he
scouted the idea of an artificial division between the literature of America
and that of England, he deprecated the too close dependence upon the
current judgments of English writers for the press, and he pleaded eagerly
for a natural literature in America, the free reflection of a free people. Now,
with the reflection of age he considers in his brief space those fundamental
principles which make for the endurance of a national literature,—the right
sense of proportion between things material and things spiritual, the
necessity of inviolable standards, the dependence upon the whole literature
of the world. His last word is a word of hope, as was befitting a prophet of
literature, standing at the end of the first century of a nation’s life, as years
are measured from the consciousness of existence.
“The literature of a people should be the record of its joys and sorrows,
its aspirations and its shortcomings, its wisdom and its folly, the confidant
of its soul. We cannot say that our own as yet suffices us, but I believe that
he who stands a hundred years hence where I am standing now, conscious
that he speaks to the most powerful and prosperous community ever
devised or developed by man, will speak of our literature with the assurance
of one who beholds what we hope for and aspire after become a reality and
a possession forever.”

Lowell sailed for England 18 May, 1889, and spent five months there at
his customary haunts in London and in Whitby, revisiting his old friends
and preferring the intimate associations to the social functions. “You ask me
so many things,” he writes to Mrs. Clifford from Radnor Place, 17 June, “in
such a breathless way—all of them disparate, and some of them desperate
—that I know not which way to turn. Besides, haven’t you confessed that
you set springes in your notes? And how can I tell but that every? is a
springe (they look like it), and that I may not find myself dangling like an
unwary hare with no chance ever to put my foot into anything again?
However, I will tread cautiously and give each of ’em a little preliminary
shake to see if there be any mischief in ’em.
“1st. Will I come to tea Thursday? I turn it over gingerly—it lies quite
still and doesn’t seem likely to go off with a jerk. I think it harmless and
answer ‘yes.’ I don’t like the artist being there with her pictures, for that
may incur me the expense of several fibs, and I am not sure how many I
have left.
“2d. Do I know Miss——? This looks more suspicious and I give it a
wide berth.
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like