Data Structures and Applications: A Simple and Systematic Approach Padma Reddy - Instantly access the full ebook content in just a few seconds
Data Structures and Applications: A Simple and Systematic Approach Padma Reddy - Instantly access the full ebook content in just a few seconds
https://ebookmass.com/product/a-textbook-of-data-structures-and-
algorithms-volume-2-mastering-nonlinear-data-structures-vijayalakshmi-
pai/
https://ebookmass.com/product/data-structures-and-algorithms-in-c-2nd-
edition/
https://ebookmass.com/product/data-structures-e-balagurusamy/
https://ebookmass.com/product/organofluorine-chemistry-synthesis-and-
applications-1st-edition-reddy-v-prakash/
A Textbook of Data Structures and Algorithms, Volume 1 G.
A. Vijayalakshmi Pai
https://ebookmass.com/product/a-textbook-of-data-structures-and-
algorithms-volume-1-g-a-vijayalakshmi-pai/
https://ebookmass.com/product/a-textbook-of-data-structures-and-
algorithms-volume-2-g-a-vijayalakshmi-pai/
https://ebookmass.com/product/kanskis-clinical-ophthalmology-a-
systematic-approach-9th-edition-john-salmon/
https://ebookmass.com/product/kanskis-clinical-ophthalmology-a-
systematic-approach-8th-edition-bradley-bowling/
https://ebookmass.com/product/columnar-structures-of-spheres-
fundamentals-and-applications-jens-winkelmann/
Chapter 1: Introduction to Data Structures
What are we studying in this chapter?
Introduction to data structures
Classification of data structures: Primitive and non-primitive data structures
Data structure operations
Inserting, deleting
Traversing, searching, sorting and merging
1.1 Introduction
In this chapter, let us discuss about the definition of data structures and see how the
data structures are classified. Basic terminology and concepts are defined along with
examples. The way the data is represented, organized, managed and structured is
crucial part of the data structures. The data to be manipulated can be used
individually or in a group under one common name and data can be of different types.
Note: Let us take an example relating to the last difference. Consider the statement
“My daughter is seven years old”. I can represent may daughter’s age as “seven in
words” or “7 in figures” or “VII in roman” or “111 in binary” or “1111111 in unary”
and so on. All these representations we call as data. Even though representation
changes, my daughter’s age has not changed. So, we say that information does not
change and data representation may change.
Note: Even though normally we use data and information interchangeably, they are
totally different and they are not synonyms.
The data are represented by the state of electronic switches. A switch with ON state
represents 1 and a switch with OFF state represents 0 (zero). Thus, all digital
computers use binary number system to represent the data. So, the data that we input
to the computer is converted into 0’s and 1’s. The letters, digits, punctuation marks,
sound and even pictures are represented using 1’s and 0’s. Thus, computers represent
data using binary digits 0 and 1 i.e., in binary number system.
Systematic Approach to Data Structures using C - 1.3
For example, consider the string “ABC01” that we type from the keyboard. This data
can be represented in the computer as shown below.
Characters typed: A B C 0 1
ASCII values 41 42 43 30 31
(Binary values) 0100 0001 0100 0010 0100 0011 0011 0000 0011 0001
All the quantities are measured in some units. For example, length may be measured
in meters or feet. On similar lines, to measure computer memory, we require units.
Now, let us see “How does the data represented using 1’s and 0’s can be grouped or
measured?” The data represented can be grouped or measured using following units:
Bit = 0 or 1
Nibble = 4 bits
Byte = 8 bits
Units of data
Kilobyte = 1024 bytes
Megabyte = 1024 Kilobytes
Gigabyte = 1024 Megabytes
Terabyte = 1024 Gigabytes
attributes
entity
student Name Usn Phone_no branch
MONALIKA 101 9900170827 CSE
Attribute values
Now, let us see “In what way the attributes, entities and entity sets are related to
fields, records and files?” The way the data are organized into the hierarchy of fields,
records and files reflect the relationship between attributes, entities and entity sets.
Now, let us see “What is a field? What is a record? What is a file”
Definition: A field is a single elementary unit of information representing an attribute
of an entity. A record is a collection of field values of a given entity. A file is a
collection of records of the entities in a given entity set.
Integers: An integer is a whole number without any decimal point or a fraction part.
No extra characters are allowed other than ‘+’ and ‘–‘ sign. If ‘+’ and ‘–‘ are present,
they should precede the number. The integers are normally represented in binary or
hexadecimal. All negative numbers are represented using 2’s complement. Based on
the sign, the integers are classified into:
Unsigned integer
Signed integer
Floating point number: The floating point constants are base 10 numbers with
fraction part such as 10.5. All negative numbers should have a prefix ‘–‘. A positive
number can have an optional ‘+’ sign. No other extra characters are allowed. The
floating point constants can be represented using two forms as shown below:
Fractional form
Floating point
notations Scientific notation
(Exponent notation)
Fractional form: A floating point number represented using fractional form has an
integer part followed by a dot and a fractional part. We can omit the digits before the
decimal point or after the decimal point. For example, 0.5, -0.99, -.6, -9., +.9 etc
are all valid floating point numbers.
Exponent form (Scientific notation): The floating point number represented using
scientific notation (also called exponential notation) has three parts namely:
mantissa e/E exponent.
1.6 Introduction to data structures and arrays
Ex1: 9.86 E 3 imply 9.86x103
Ex2: 9.86 e -3 imply 9.86x10-3
where
The mantissa can be an integer or a floating point number represented using
fractional notation.
The letter e or E should follow mantissa.
The exponent should follow e or E. The exponent has to be an integer with
optional ‘+’ or ‘–‘ sign.
For example,
6.698274e2 means 6.698274 x 102
-0.36e-54 means -0.36 x 10-54
Observe from the table that character ‘A’ has an ASCII value 41, the character ‘B’
has an ASCII value 42 and character ‘C’ has an ASCII value 43. So, if we type the
text “ABC” from the keyboard, to the computer, it appears as shown below:
A B C (Characters)
41 42 43 (ASCII values)
0100 0001 0100 0010 0100 0011 (Binary values )
Systematic Approach to Data Structures using C - 1.7
Pointer: A pointer is a special variable which contains address of a memory location.
Using this pointer, the data can be accessed.
For example, assume that a program contains four occurrences of a constant 3.1459.
During the compilation process, four copies of 3.1459 can be created as shown below:
c 3.1459 a
The variables b, c and d are called pointers since they contain address of variable a.
For example, arrays, structures, stacks, queues, linked lists, trees, graphs, files
etc., are some of the non- primitive data structures.
Now, let us see “What are the different types of non-primitive data structures?” The
non-primitive data structures are classified as shown below:
Definition: The data structure where its values or elements are not stored in a
sequential or linear order is called non-linear data structures. Unlike linear data
structures, here, the logical adjacency between the elements is not maintained and
hence elements cannot be accessed if we go in sequential order. In non-linear data
structures, a data item (or an element) could be attached to several other data items.
For example, graphs, trees, files are all non-linear data structures.
Now, let us “Explain non-linear data structures?” All the non-linear data structures
such as arrays, stacks, queues, linked lists, graphs, trees and files are discussed below:
Arrays: Definition: An array is a special and very powerful data structure in C
language. An array is a collection of similar data items. All elements of the array
share a common name. Each element in the array can be accessed by the subscript
(or index). Array is used to store, process and print large amount of data using a
single variable.
Ex 1: Set of integers, set of characters, set of students, set of pens etc. are
examples of various arrays.
10 15 20 25 30
A[0] A[1] A[2] A[3] A[4]
Systematic Approach to Data Structures using C - 1.9
Ex 3: An array of 5 characters is pictorially represented as shown below:
Stack: A stack is a special type of data structure (linear data structure) where
elements are inserted from one end and elements are deleted from the same end.
Using this approach, the Last element Inserted is the First element to be deleted
Out, and hence, stack is also called Last In First Out (LIFO) data structure.
The stack s={a0, a1, a2,……an-1) is pictorially represented as shown below:
Insert Delete The elements are inserted into the
stack in the order a0, a1, a2,……an-1.
That is, we insert a0 first, a1 next and
so on. The item an-1 is inserted at the
an-1 Top of stack end. Since, it is on top of the stack, it
is the first item to be delted. The
various operations performed on
a2 stack are:
Insert: An element is inserted
a1
from top end. Insertion operation
a0 Bottom of stack is called push operation
Delete: An element is deleted from top end only. Deletion operation is called pop
operation.
Overflow: Check whether the stack is full or not.
Underflow: Check whether the stack is empty or not.
Queue: A queue is a special type of data structure (linear data structure) where
elements are inserted from one end and elements are deleted from the other end.
The end at which new elements are added is called the rear and the end from
which elements are deleted is called the front. Using this approach, the First
element Inserted is the First element to be deleted Out, and hence, queue is also
called First In First Out (FIFO) data structure.
For example, consider the queue shown below having the elements 10, 50 and 20:
q
10 50 20
0 1 2 3 4
front rear
The items are inserted into queue in the order 10, 50 and 20. The variable q is
used as an array to hold these elements
1.10 Introduction to data structures and arrays
Item 10 is the first element inserted. So, the variable front is used as index to
the first element
Item 20 is the last element inserted. So, the variable rear is used as index to
the last element
Linked lists: A linked list is a data structure which is collection of zero or more
nodes where each node is connected to the next node. If each node in the list has
only one link, it is called singly linked list. If it has two links one containing the
address of the next node and other link containing the address of the previous
node it is called doubly linked list. Each node in the singly list has two fields
namely:
info – This field is used to store the data or information to be manipulated
link – This field contains address of the next node.
The pictorial representation of a singly linked list where each node is connected to
the next node is shown below:
first
20 30 10 60 \0
The above list consists of four nodes with info fields containing the data items 20,
30, 10 and 60.
Graphs: A graph is a non-linear data structure which is a collection of vertices
called nodes and the edges that connect these vertices. Formally, a graph G is
defined as a pair of two sets V and E denoted by
G = (V, E)
where V is set of vertices and E is set of edges. For example, consider the graph
shown below:
5
4 E = { (1, 6), (1, 2), (2, 3), (4, 3), (5, 3), (5, 6), (6, 4) }
2 0 is set of edges
Note:|V| = |{1, 2, 3, 4, 5, 6}| = 6 represent the number of
3 vertices in the graph.
|E| = |{(1, 6), (1, 2), (2, 3), (4, 3), (5, 3), (5, 6), (6, 4) }| = 7 represent the
number of edges in the graph.
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Systematic Approach to Data Structures using C - 1.11
Trees: A tree is a set of finite set of one or more nodes that shows parent-child
relation such that:
There is a special node called the root node
The remaining nodes are partitioned into disjoint subsets T1, T2, ……Tn, n ≥ 0
where T1, T2, T3 ……Tn which are all children of root node are themselves
trees called subtrees.
Ex1 : Consider the following tree. Let us identify the root node and various
subtrees:
The tree has 8 nodes : A, B, C, D, E,
root A
F, G and H.
subtrees The node A is the root of the tree
We normally draw the trees with root
B C D at the top
The node B, C and D are the children
E F G H of node A and hence there are 3
subtrees identified by B, C and D
The node A is the parent of B, C and D whereas D is the parent of G and H
Binary tree: A binary tree is a tree which is collection of zero or more nodes and
finite set of directed lines called branches that connect the nodes. A tree can be
empty or partitioned into three subgroups namely root, left subtree and right
subtree.
Root – If tree is not empty, the A
first node is called root node.
left subtree – It is a tree which is
connected to the left of root. B D
Since this tree comes under root,
it is called left subtree.
right subtree – It is a tree which C E F I
is connected to the right of root.
Since this tree comes under the H J
root, it is called right subtree.
Each of the operations can be performed one after the other. For example, given an
item, we may have to traverse the list and during this process we can search for the
item in the list. If the item is present in the list, we may delete that item and insert
another item in that place. Then we may have to sort the resulting list and display the
sorted list.
Exercises
1) What is data? What is information?
2) What are the differences between data and information?
3) Define the terms: entity, attribute, entity set, field, record, file
4) Define data structures and types of data structures
5) What are primitive data structures? Explain
6) What are non-primitive data structures? Explain
7) Explain the different types of non-primitive data structures
8) What are the different types of number systems that are commonly used?
9) What are linear data structures? What are non-linear data structures? Explain
10) What are the operations performed on various data structures?
Chapter 2: Arrays
What are we studying in this chapter?
Arrays: Definition and representation of linear arrays in memory
Dynamically allocated arrays (Discussed in chapter 3)
Array operations
Traversing, Inserting and deleting
Searching and sorting
Multi-dimensional arrays
Application of arrays:
Polynomials (discussed in structures and unions – chapter 5)
sparse matrices (discussed in structures and unions – chapter 5)
2.1 Introduction
In this section, let us see array concepts in detail. First, let us see “What is an array?”
Ex 1: Set of integers, set of characters, set of students, set of pens etc. are examples of
various arrays.
10 15 20 25 30
A[0] A[1] A[2] A[3] A[4]
Now, the question is “How to access these elements?” Since an array is identified by
a common name, any element in the array can be accessed by specifying the subscript
(or an index). For example,
0th item 10 can be accessed by specifying A[0]
1st item 20 can be accessed by specifying A[1]
2nd item 30 can be accessed by specifying A[2]
3rd item 40 can be accessed by specifying A[3]
4th item 50 can be accessed by specifying A[4]
Now, let us see “How to declare and define a single dimensional array?” As we
declare and define variables before they are used in a program, an array also must be
declared and defined before it is used. The declaration and definition informs the
compiler about the:
Type of each element of the array
Name of the array
Number of elements (i.e., size of the array)
The compiler uses this size to reserve the appropriate number of memory locations so
that data can be stored, accessed and manipulated when the program is executed. A
single dimensional array can be declared and defined using the following syntax:
data type such as int, float, char etc.
name of the array
expression must be evaluated to integer
type array_name [ int_expression ]; // semicolon is must at the end
Number of items = ub – lb + 1
=9 -5 +1
=5
Observe that in C language, array index always starts from 0 whereas in Pascal
language, array index can start from any integer (even negative indexing is possible in
Pascal). Now, let us see “How to obtain the location of a[j] in a single dimensional
array?” Let us take the following array declaration in Pascal language:
a : array[5..9] of integer; // Here, lower bound : LB = 5
// upper bound : UB = 9
where
x is the distance from base address upto jth row
2.4 Arrays
Calculation of x: Given the base address, the distance from base address can be
obtained as shown below:
Expressing in
terms of index
Address of each row
Given any element a[j], its address can be calculated using the above relation and
the time taken to calculate location is same. So, the time taken to access a[5], a[6],
a[7], a[8] and a[9] remains same.
The time taken to locate any element a[j] is independent of j. That is, irrespective
of j, the time taken to locate an array element a[j] remains same.
This is very important property of linear arrays. (Linked lists discussed in chapters
8 and 9 do not have this property.
Systematic Approach to Data Structures using C - 2.5
Example 2.1: A car manufacturing company uses an array car to record number of
cars sold each year starting from 1965 to 2015. Rather than beginning the array index
from 0 or 1, it is more useful to begin the array index from 1965 as shown below:
500 504 508 512 516 …….. 700
Example 2.2: Consider the linear arrays AAA(5:50), BBB(-5:10) and CCC(1:18)
(a) Find the number of elements in each array
(b) Suppose Base(AAA) = 300 and w = 4 words per memory cell for AAA. Find
the address of AAA[15], AAA[35] and AAA[55]
Solution:
(a) The number of elements in each array can be calculated using the following
relation:
Number of elements = ub – lb + 1
So, number of elements of array AAA = 50 – 5 + 1 = 46
Number of elements of array BBB = 10 – (-5) + 1 = 16
Number of elements of array CCC = 18 – 1 + 1 = 18
(b) It is given that Base(AAA) = 300, w = 4, lb = 5
We know that Loc(a[i]) = Base(a) + w *(i – lb)
Loc(AAA[15]) = 300 + 4 * (15 – 5) = 340
Loc(AAA[35]) = 300 + 4 * (35 – 5) = 420
Loc(AAA[55]) cannot be computed since 55 exceeds ub = 50
2.6 Arrays
The various operations that can be performed on arrays are shown below:
Traversing
Inserting
Deleting
searching
sorting
2.3.1 Traversing
Now, let us see “What is traversing an array?” Visiting or accessing each item in the
array is called traversing the array. Here, each element is accessed in linear order
either from left to right or from right to left.
In this section, let us see “How to read the data from the keyboard and how to display
data items stored in the array?”
We can easily read, write or process the array items using appropriate programming
constructs such as for-loop, while-loop, do-while, if-statement, switch-statement etc.
Consider the declaration shown below:
int a[5];
Here, memory for 5 integers is reserved and each item in the array can be accessed by
specifying the index as shown below:
Using a[0] through a[4] we can access 5 integers.
Note: In general, Using a[0] through a[n-1] we can access n data items.
Once we know how to access each location in the memory, next question is “How to
store the data items in these locations which are read from the keyboard?”
This is achieved by reading n data items from the keyboard using scanf() function
which is available in C library as shown below:
Systematic Approach to Data Structures using C - 2.7
scanf(“%d”, &a[0]);
scanf(“%d”, &a[1]);
scanf(“%d”, &a[2]);
………………
………………
scanf(“%d”,&a[n-1]);
So, in C language, if we want to read n data items from the keyboard, the following
statement can be used:
Similarly to display n data items stored in the array, replace scanf() by printf()
statement as shown below:
for (i = 0; i < n; i++)
{
printf(“%d”, a[i]);
}
Now, the function to create an array by reading n elements can be written as shown
below:
Example 2.3: Functions to read n items into an array
Now, let us see “How to insert an item into an unsorted array based on the position?”
Design: An item can be inserted into the array by considering various situations as
shown below:
Step 1: Elements are present (Invalid position): This case can be pictorially
represented as shown below:
Item = 60
a 50 40 20 90 70 80 30
0 1 2 3 4 5 6 7 8 9
n=7 1
pos
Can you insert an item at 8th position onwards in the above array? No, we cannot
insert since, it is invalid position. That is, if pos is greater than 7 or if pos is less than
0, the position is invalid. The code for this case can be written as shown below:
if (pos > n || pos < 0) // When pos is greater than number of items
{
1 printf (“Invalid position\n”);
return n; // No insertion and return number of items
}
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Other documents randomly have
different content
Visconti; but that monarch preferred the large sum which they
offered him for his sanction of their rule as Imperial Vicars, rather
than the hostility of princes who could assemble six thousand men-
at-arms and numberless foot soldiers beneath his window as a
spectacle for his entertainment when he visited them in Milan. The
Gonzaga of Mantua, once their allies and now their bitterest foes,
leagued, however, with the Church and the hereditary foes of the
Visconti and dealt them some heavy blows. The German company
which the Mantuan princes employed invaded the Milanese
territories under the formidable Count Lando, and penetrated nearly
to the capital. But the citizens, in spite of their softness and lack of
military practice, went forth with the courage of despair and
defeated and drove away the Count, who was greatly surprised,
since he nothing esteemed the Milanese. In other directions the
Visconti suffered great losses. Genoa revolted in 1356, and to secure
peace they were compelled to surrender Parma and Asti two years
later.
The eldest brother, Matteo, had died in 1355. Weak, injudicious and
a glutton, he was only a hindrance to the progress of his House.
General report laid his death to his brothers’ charge. Bernabò and
Galeazzo made a fresh division of the State, and Milan itself was split
up between them. They worked together, however, with a single
aim, in spite of mutual hatred and jealousy, to repair the losses of
their State. Pavia had set up a free government, headed by the friar,
Giacomo de’ Bussolari, who, an earlier Savonarola, sought to purge
his city from tyranny and sin at once. Steadfastly beset by Galeazzo’s
army, it had to yield at last to famine and sickness. Further afield
Bernabò spent years in a desperate struggle to recover Bologna,
under a tempest of papal anathemas, and though baffled himself, he
prepared the way for his successor. He was constantly in fierce
conflict with the Marquises of Este, whose rebel kinsmen he
sheltered while they employed Luchino’s disinherited sons against
him. Galeazzo on his side had to sustain the assaults of Savoy and
Montferrat, which came near to ruining him.
But multitudinous and determined as their enemies were, the
inimitable statecraft which was the Viscontean heritage, backed by
their vast resources, enabled them to restore their power and to
make Milan feared and respected everywhere abroad. These princes
rarely took the field themselves, but entrusted their enterprises to
the foreign companies by whom the Italian wars were now chiefly
waged. These bands of hardy and unscrupulous adventurers, who
were proof against the enervation which wealth and civilisation had
induced in the Italians, were become powerful factors in the politics
of the country. Most formidable of all was the company of Sir John
Hawkwood. These English mercenaries, says Azario, were more
excellent robbers than any of the other plunderers of the Lombards.
By day they mostly slept and waked by night. And so diligent and
skilful were they in capturing towns that their like had never been
seen. After suffering much from Hawkwood’s zeal against him in the
service of the Pope, Bernabò bribed him to his own side; but after a
few years the great captain, faithful only to caprice, suddenly
deserted the Visconte, with disastrous results to the latter. Later on,
Bernabò tempted him again by the gift of one of his own daughters
in marriage, with a large dowry. Nevertheless, the later part of
Hawkwood’s career was spent in the pay of Milan’s inveterate foe,
Florence.
Milan, unaffected by the quarrels of her sovereigns, was now the
richest, most populous and luxurious city of Italy. The capitals of the
great European kingdoms had no such splendid palaces, such
comely-paved streets, such fair-fountained gardens and pleasaunces
trodden by beautiful exotic beasts and birds, as this seat of citizen
princes. The Visconti assumed the dignity and state of royalty.
Galeazzo was himself married to a princess of the ancient House of
Savoy, and both brothers pursued the sagacious policy of making
alliances for their children with the sovereign Houses of Europe.
Bernabò made statesmanlike use of his ten daughters and five sons
by his wife Regina della Scala, and his score or so of illegitimate
children, wedding them, according to the conditions of their birth, to
royal princes and great Italian potentates, or to lesser nobles and
successful soldiers, such as Hawkwood and Count Lando. Galeazzo
married his one son and daughter with even greater splendour, and
endowed them so lavishly that it was almost the ruin of his State.
For his heir, Gian Galeazzo, he obtained the hand of Isabella de
Valois, for a sum of five hundred thousand florins. The maiden
Violante he gave to Lionel, Duke of Clarence, son of Edward III.,
with two hundred thousand florins and many fair lands and castles in
Piedmont.
This last marriage was celebrated in 1368, with unexampled
magnificence. The bridegroom arrived in Milan accompanied by the
Sire le Despencer and a train of two thousand Englishmen. A
splendid cavalcade went forth to meet him. First came Galeazzo
himself, who was said to be more beautiful in person than any other
man in Italy, wearing, as his custom was, a wreath of roses on his
flowing golden hair, and attended by his greatest vassals. With him
was his wife, Bianca of Savoy, and his daughter-in-law, the young
French Isabella, and other noble ladies, followed by eighty damsels
apparelled in scarlet, with sleeves of white cloth embroidered with
trefoils, and girdles so richly worked that their worth was eighty
florins each. Gian Galeazzo, a boy of fifteen, came next, leading a
company of knights on steeds caparisoned as if for a joust, and after
these followed the officers of State and of the household with their
pages, all gorgeously arrayed. At the marriage feast the very meats
were gilded, and with each of the sixteen courses splendid gifts were
offered to the guests—highly-bred hounds with velvet and silken
collars and leashes of silk; falcons with chains of gold and hoods of
velvet, and silver buttons enamelled with the Snake; richly
ornamented saddles and other horse furniture; suits of armour
fashioned by the famous Milanese smiths; brocades of gold and
richest silk, silver flagons worked with enamel, silver-gilt basins,
mantles and doublets thickly sewn with pearls for the prince, and
seventy-six splendid coursers and war-horses, each more generous,
beautiful, and gorgeously caparisoned than the one before; and last
of all twelve fat oxen. Galeazzo and the bridegroom sat at one table
with the noblest of the guests, among whom was Messer Francesco
Petrarca the poet, in the most honourable place. At another were
placed Regina della Scala and a number of ladies. Such scenes as
these are dimly pictured for us in primitive frescoes here and there,
in which we see assemblages of ladies in jewelled robes and lofty
peaked head-dresses, and gentlemen correspondingly fine stiffly
seated at narrow boards, or pacing with slow and stately step
through the dance within some spacious pillared hall.
Though extravagantly lavish for State purposes, the Visconti did not
keep open Court like their predecessors. No tables were set out in
the streets for the common people on holidays, no oxen roasted
whole or wine-vats broached for all who liked to drink. The
chroniclers complain of the avarice of their Lords. The taxes were
continually increased. Pressed by the huge cost of their wars and
their alliances, the Visconti were in fact always in need of money,
and so assured was their supremacy in Milan, that they no longer
feared the discontent of the citizens. With the development of their
despotism the social gulf between the Visconti and the rest of the
community had grown wide. Both brothers were proud, suspicious
and cruel. But the severity of the silent Bernabò, and his terrible fits
of rage and strange capricious temper, made him the most feared.
He was laudably resolved to maintain justice and order, so that a
man might go unarmed through any part of his dominions, and to
suppress the old faction hatreds, but his methods were intolerably
harsh. No one was allowed to call himself Guelf or Ghibelline on pain
of having his tongue cut out. To be found abroad in the city at night,
for any reason whatever, was to lose a foot, and so forth. Moreover,
on mere suspicion people were put to cruel death or torment. This
arbitrary severity was, however, of little avail, and crime was far
more rife in the city than before Bernabò’s time. The tyrant’s passion
for dogs was as extravagant as his disregard for human suffering. He
had five thousand hounds, which his subjects were compelled to
keep and tend for him, and if one were found to be either too fat or
too lean for the chase, or to have come to any harm, woe to its
guardian. Every sort of game was sacred to the prince’s sport, and
the peasants who slew wild boars or other forest creatures for food
during a severe famine, were hanged or blinded. Two Franciscan
brothers, who dared to expostulate with the prince for his
harshness, were burnt as heretics, an act something ironical on the
part of one who himself spent nearly all his life under the ban of the
Church. There was a certain grim humour in some of Bernabò’s
fierce deeds, as in his treatment of two dignified Benedictine abbots,
who were sent to treat with him by the Pope. The prince met them
on a bridge over the Lambro, where, with due reverence, they
presented to him the pontifical Bulls. Bernabò read them, and
looking up, eyed the legates grimly, and asked them whether they
would prefer food or drink. Perceiving a sinister meaning in the
question, the trembling clerics glanced at the deep river flowing
beneath, and said that they would rather eat. Whereupon the papal
missives, parchment, seals, silk cord and all, were crammed down
their throats.
Galeazzo was not so capriciously cruel as his brother, but his rule
was equally oppressive. To add to the afflictions of the people, the
country was devastated by the foreign Companies, who robbed
friends and foes alike; and years of famine and pestilence came,
which their Lords took no more thoughtful measure to relieve than
hanging some of the chief ministers. To both brothers clings the
horrible reproach of a decree, condemning prisoners of State to the
so-called Quaresima, a series of tortures lasting forty days. Yet
Galeazzo was conspicuous for domestic virtues, and both princes
were very devout, and founded many churches and convents, and
gave largely in alms. One has to remember in judging these
sovereigns that the Florentine chroniclers, who have always held the
ear of the world, hated them as the enemies of their city. They
depict them as barbarous and ignorant tyrants, sunk in gross vice.
Yet Petrarca, the recognised sovereign of thought and letters in
fourteenth century Italy, spent several years at Milan, in the service
first of Archbishop Giovanni, and afterwards of Galeazzo, and speaks
of the city and its Lords with great affection and respect. The high
honour which the Visconti paid to the poet shows their regard for
the things of the spirit. Their capture of Petrarca was felt to be as
great a triumph as the conquest of a province. Boccaccio and other
Tuscan writers inveigh fiercely against their countryman for his
adherence to the Visconti, pretending that he who loved freedom
had been deluded by the vulgar worship of riches and luxury, and
had become a slave. But Petrarca, whose close acquaintance could
judge better of his hosts, probably appreciated the large and far-
reaching political ideas which were the heritage of the Visconti, and
perhaps saw in Milan a hope for Italy, outside the conception of the
Florentines, the possibility of a larger freedom in national union,
which should restore the successors of the Romans to their lost
glory.
The Visconti, moreover, took great pains to advance learning and
culture in their dominions. They founded the University of Pavia, the
once celebrated school of jurisprudence there having long decayed,
and richly endowed its chairs, and it was Galeazzo who started the
famous library at Pavia, to which all students were allowed access.
Bernabò was something of a scholar himself, and had studied the
Decretals in his youth; but the anxiety of constant wars and the
cares of State hindered him from doing all that he would willingly
have done for the intellectual welfare of the capital.
The bitter jealousy which prevailed between the two brothers
divided them much in later years, though it could not disunite them
in the face of their foes, and Galeazzo had left Milan and removed
his Court to Pavia, though still keeping his share of the government
of the capital. He died in 1378. His son, Gian Galeazzo, was delicate
of constitution, of retiring habits, and much given to study. The
gentleness with which he began to rule, remitting taxes and seeking
to propitiate his subjects, excited the scorn of the grim Bernabò,
who readily accepted the proposal of the young widower—Isabella
de Valois having died—for the hand of his daughter Caterina,
thinking thus to get an extra hold upon him. Little did the veteran
prince suspect that this mild recluse, who was hardly ever seen out
of his palace at Pavia, was the very quintessence of that subtlety,
tenacity and ambition which had made the House of the Visconti the
most dreaded in Italy. Gian Galeazzo’s genius for statecraft had been
carefully trained by his father. While Bernabò regarded him as of
little account, he was strengthening his position both at home and
abroad by quiet diplomacy, and evolving mighty schemes in his
mind, while he patiently waited the ripe moment for their
accomplishment.
There is nothing more dramatic in all the sensational story of
mediæval Italy than Gian Galeazzo Visconte’s sudden spring to
power. Seven years had passed since his father’s death, and
Bernabò’s tyranny had grown ever more oppressive, in sharp
contrast to his fellow-ruler’s. One day in 1385 Gian Galeazzo set
forth from Pavia for Milan, escorted by four hundred men-at-arms,
having announced his intention of visiting a holy shrine near Varese
and his desire of embracing his honoured uncle on his way. He had
arranged not to enter the capital, but to skirt the walls till he
reached the castle beside Porta Giovia, recently built by his father.
Laughing at the young man’s caution and his pusillanimity in
bringing so large an escort, the elder Visconte sent two of his sons
on ahead, and swinging himself into the saddle, galloped off, with
two or three servants only, to meet his nephew. The two Sovereigns
had but exchanged greetings when, Gian Galeazzo signed to the
captain of his escort, Jacopo dal Verme, who laid his hand upon
Bernabò’s shoulder, and in a moment the tyrant found himself a
prisoner. With his sons he was hurried into the Castle of Porta
Giovia. Gian Galeazzo entered the city and was received with
immense joy. Not vainly had he counted upon the terror and hatred
which his uncle had excited. The people, rushing to the houses of
the fallen tyrant and his sons, sacked them from end to end, fired
and tore them down, and razed them to the ground. In a General
Council of the citizens the sole and absolute dominion of Milan was
unanimously conferred upon Gian Galeazzo and upon his male heirs.
Bernabò was removed soon after to the Castle of Trezzo, and died
seven months later, of poison, it was said. His sons, except the two
captured, had fled in all directions, and were doing their utmost to
raise help against the usurper. But so perfectly had Gian Galeazzo
conceived and accomplished his great stroke, and with the exercise
of such consummate diplomacy and such victorious arms did he
secure himself afterwards, that not one of Bernabò’s children, in
spite of their princely alliances, were able, with all their constant
efforts, to overthrow him or recover any part of their heritage.
The usurper’s one excuse for his treachery was that his uncle and
cousins had been openly intriguing against him. Immediately after
the capture of Bernabò he drew up a solemn indictment against him,
charging him with a catalogue of appalling crimes, and with insidious
designs against his, Gian Galeazzo’s, life, and sent it to all the Courts
of Europe. This characteristic attempt to give legal justification to his
action deceived nobody. Italy at large regarded the young ruler with
an admiration and dread which events soon proved well-founded.
The brain which had shown such sovereign dissimulation cherished
ambitions before which whole cities and states were to fall. It was
not long before his schemes began to be fulfilled. The story of Gian
Galeazzo’s military enterprises is one of almost unbroken conquest.
He was no soldier himself, but he knew how to choose his generals,
and he got the best out of them by interfering with them little and
rewarding them very generously. The chaotic state of Italy at the
time gave him his chance. So extraordinary was his success, that he
was regarded as something almost diabolical. It seemed to his
terrified enemies that he fascinated those whom he marked for
destruction, so that they fell with eyes open into his snares.
Francesco da Carrara, Lord of Padua, was persuaded to aid him to
overthrow the Scaligeri of Verona. That city having been conquered
in 1387, Gian Galeazzo picked a quarrel with his ally, besieged and
captured Padua (1389), and sent Francesco to die in the dungeons
of Monza. Master now of Verona and Padua, the Visconte had
touched the Adriatic shore. Meanwhile Mantua and Venice looked on
stupidly and awaited their own destruction as if paralysed. General
fear possessed Italy at the rapid progress of the conqueror, who,
unseen himself, directed his instruments with such unfailing insight
to his desired ends. The Visconte’s policy was to strike at the weak
first and gradually prepare the way for greater enterprises. The
Church was at this time in the throes of the Great Schism, and Gian
Galeazzo, protesting conscientious difficulties in deciding to which
Pope he owed spiritual obedience, played them against one another,
while he seized the papal fiefs in the Romagna. His armies climbed
the mountains and poured into Umbria and Tuscany. Aroused at last
by the example and exhortations of Florence, Italy shook off her
stupor, and a general effort was made to stem the advance of the
Visconte. Yet still he crept on, remedying the checks to his arms by
his stealthy diplomacy. The King of France, in answer to the appeal
of Florence, sent an army to invade his States, but it was routed by
Jacopo dal Verme, and Charles VI. was himself converted into an ally
by the Visconte’s flatteries and promises. In 1399 he triumphed over
Florence again by acquiring Pisa, without a blow, from Gerardo
d’Appiano, while Perugia, Siena and Assisi submitted to his generals.
Already in 1395 Gian Galeazzo’s great increase of power and
prestige had been marked by his elevation to a new dignity. His
untiring negotiations, backed by the offer of an enormous sum,
persuaded the Emperor Wenceslaus to constitute the Milanese State,
including a number of conquered cities, into a Duchy, and to invest
the Visconte and his male heirs with it in perpetuity. The ceremony
of investiture took place in the Piazza of St. Ambrogio, where upon a
great throne the imperial legate robed and crowned the new duke in
the sight of all the people, in the midst of every pompous
circumstance, while in the basilica afterwards the Bishop of Novara,
destined to become Pope Alexander V., preached the sermon and
lauded the subject of his oration for his illustrious blood, his
conspicuous beauty of person and the virtuous tranquillity of his
mind.
Gian Galeazzo was as great an administrator as statesman and
conqueror. By wisdom, economy, careful distribution of taxation and
supervision of finances, he relieved the people from the cruel and ill-
considered burdens imposed by the bad management of his
predecessors, while increasing his own resources enormously. He
was the very genius of order. He saw that the law was properly and
effectively carried out, justice done to all, and perfect rule
maintained throughout the State. It was by his generous, just, and
wise government of the cities which he conquered that he
consolidated his vast dominions.
In these favourable conditions Milan flourished exceedingly, and
could contribute without overwhelming distress her share of the
duke’s annual revenue of twelve hundred thousand florins, and of
the extra levies for special purposes, amounting sometimes to eight
hundred thousand florins in one year—sums far exceeding those
commanded by any other Italian prince.
Gian Galeazzo’s rule, though sometimes oppressive, was not carried
on by the harsh methods of his predecessors. Violence and wanton
cruelty were probably repugnant to his sensitive physical
temperament and despicable to his unimpassioned mind. He was
never bloody, except for a purpose, as in the awful sack of Verona
after her revolt and recapture in 1390. But for a refined and
ingenious cruelty which exercised itself in long worming plots ending
far off in some unexpected catastrophe, Gian Galeazzo seems to
have had an artistic predilection. It was he, men said, who by Iago-
like suggestions drove Francesco Gonzaga of Mantua to slay his wife
Agnese, one of Bernabò Visconte’s daughters, in a frenzy of jealousy,
that he himself might be first and loudest afterwards in proclaiming
the innocence of the lady and exciting general execration of the
murderer. The beheading of young Obizzo d’Este at Ferrara has been
also attributed to evil suspicions which the Milanese prince instilled
into the Marquis Alberto for political ends. The Visconte’s influence is
plainer still in the hideous treachery and ingratitude of Jacopo
d’Appiano, who, with a kiss of peace, slew his protector and friend,
the noble Pietro Gambacorti, and made himself Lord of Pisa for Gian
Galeazzo’s benefit, as very shortly appeared.
The Duke’s piety was as marked as his less estimable characteristics.
He did not doubt his own righteousness or hesitate to invoke the aid
of Heaven for all his enterprises. He was assiduous in his devotion to
the Saints and observance of the Church’s rites and ceremonies. The
Cathedral of Milan, the vast Certosa of Pavia, and many other great
buildings, were planned and founded by this prince. These works
were not done solely for a spiritual reward, but also to proclaim his
own glory to the world and to encourage art and industry. All Gian
Galeazzo’s greatness of spirit showed in his buildings. His
engineering schemes were as mighty and daring in conception as
undaunted and patient in accomplishment. To subdue Padua and
Mantua he undertook the gigantic task of diverting the Brenta and
Mincio. But here he measured himself too audaciously against
natural forces. One night the Mincio, ‘in piena,’ hurled its waters at
the huge dam and swept away the work which had cost untold
labour and gold.
With all his occupations of war and statesmanship, Gian Galeazzo
found time to continue his father’s patronage of Letters. He had as a
youth studied deeply himself in the University of Pavia. An early
fresco at Pavia, now long lost, represented him as a child standing in
a crowd of nobles and distinguished men in his father’s palace, and
in answer to the question, who was the greatest man present,
pointing to the poet Petrarca. This allegory recorded the honour
which he paid all his life to intellect and learning. He called the
greatest scholars to the Chairs of the University, including Emanuel
Chrysoloras, who thus brought to Milan the newly reviving
knowledge of Greek. He made these men his councillors and familiar
associates. They read poetry to him and discussed the new
discoveries of antiquity, so that his castle has been called a temple
of wisdom. Architecture, sculpture, painting were equally fostered by
him. There was no sort of human activity which he did not seek to
stimulate for the advantage and glory of his State.
Though its operations meant destruction to lesser powers, Gian
Galeazzo’s brain was essentially kingly and creative. This was the
moment in Italy of the formation of great States. The old faction
struggles of the era of freedom had come to an end with the
establishment of tyrannies, and of these the lesser were now being
swallowed up by the greater. In this process Milan under the Visconti
was the leader. Its natural outcome seemed to be the foundation of
a great settled kingdom in the peninsula, like France and England in
the North. The patriotic spirits of the time dreamed of such a
kingdom as the redemption of Italy from her woes of constant
dissension and warfare. The idea took practical shape in the mind of
the great Matteo’s descendant and heir, in whom character and
circumstance united to carry the large political thought and ambition
of the Visconti nearest to its supreme fulfilment. And it was to Gian
Galeazzo that the dreamers looked for the realisation of their desire,
as perhaps Petrarca had looked to the earlier generation. Fazio degli
Uberti, the fourteenth century Florentine poet and exile, who lived
long at the Viscontean Court, in one of his canzoni makes Rome cry
—
‘O figliuol mio, da quanta crudel guerra
Tutti insieme verremo a dolcie pace
Se Italia soggiace
A un solo re....’[2]
2.
‘Oh my son, from what cruel warfare
Should we come all together to sweet peace
Could Italy be subject
To one sole king....’
Their lament was justified. The direct result of the tyrant’s death was
the release of all the elements of disorder and reaction in Italy, the
revival of angry faction, the break-up of a great organised State
among a host of greedy and warring pretenders, and the terrorism
of military adventurers over the whole country, ending in the
establishment of a dynasty in Milan destined to sell Italy to her final
shame and ruin. What if Gian Galeazzo had lived a few years longer?
Florence would probably have fallen before him, Florence whose
incurable spirit of individualism had been the one barrier between
him and his ambition. But was that single little torch of liberty, which
itself was soon to waver and be spent, worth the sacrifice of a
united and peaceful Italy, strong enough to resist all outside foes,
forward enough to lead all Europe in the path of progress?
Yet if that noble fruition of art and civilisation which glorifies the
fifteenth century in Florence was conditional on her independence,
then Italy through all the tears of her after centuries of sorrow and
humiliation might well answer Yes.
THE SNAKE OF THE
VISCONTI
CHAPTER VI
From Visconti to Sforza
“Una città corrotta che vive sotto un principe ... mai non si può ridurre libera.”—
Macchiavelli.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookmass.com