Lecture 1: Introduction To Data Structures: Have You Ever Wondered?
Lecture 1: Introduction To Data Structures: Have You Ever Wondered?
Summary of Lecture:
What is the most important factor for any event/ task to take place?
Any task or job done involves the movement/ processing of data.
Before starting our discussion on data structures, let us first consider what data are and how they
support information systems. Fig. below illustrates the roles that data play in the events of any
organization. The large circle labeled "data" represents the overall data resource of the
8
organization. This resource is an active participant in the organization's operations and planning.
The small circles represent individual elements or items of data. These elements can be
considered to be raw facts. They are aggregated and summarized in various meaningful ways to
form information. Decisions are made on the basis of this information. The results of decisions
are actions, which in turn generate more data. These data then can be incorporated into another
cycle of the decision-making process.
Sources of Information
Any given data element may participate in the generation of multiple "pieces" of information. It
9
is important that there be flexibility in the ways that data items can be aggregated and
summarized, so that meaningful information can be produced to support the decisions at hand.
Note also that some data elements in an organization's data resource may have resulted from
actions taken by forces or bodies external to the organization. The actions of competitors, the
behavior of customers or clients, and the forces of legal requirements all enter into an
organization's decision-making process.
Kinds of Decisions
The data resource must support several types of decision-making. It is convenient to recognize
three levels of decisions:
DATA MANAGEMENT
Data are expensive. They must be managed in such a way that they are correct and are available
to produce needed information. Aspects of data handling include the following:
• Measurement
• Collection
• Transcription
• Validation
• Organization
• Storage
10
• Aggregation
• Update
• Retrieval
• Protection
The objective of a data management system is to make the data resource resilient, flexible, and
adaptable to supporting an organization's decision-making processes. Four useful guidelines for a
data management system are:-
1. Data must be represented and stored so that they can be accessed later.
2. Data must be organized so that they can be selectively and efficiently accessed.
3. Data must be processed and presented so that they support the user environment
effectively.
4. Data must be protected and managed so that they retain their value.
This unit comprising of this lesson and some following ones is an introductory unit and gives
you an understanding of what a data structure is. Knowledge of data structures is required of
people who design and develop computer programs of any kind : systems software or
applications software. As you have learnt in earlier blocks, data are represented by data values
held temporarily within program's data area or recorded permanently on a file. Often the
different data values are related to each other. To enable programs to make use of these
relationships, these data values must be in an organized form. The organized collection of data is
called a data structure. The programs have to follow certain rules to access and process the
structured data. We may, therefore, say data are represented that:
11
If you recall, this is an extension of the concept of data type. We defined a data type as:
Further, we had seen that simple data type can be used to built new scalar data types, for example
enumerated type in C. Similarly there are standard data structures which are often used in their
own right and can form the basis for complex data structures, like Arrays, are basic building
block for more complex data structures.
Designing and using data structures is an important programming skill. In this and in subsequent
units, we are going to discuss various data structures.
We may classify these data structures as linear and non-linear data structures. However, this is
not the only way to classify data structures. In linear data structure the data items are arranged in
a linear sequence like in an array. In a non-linear, the data items are not in sequence. An example
of a non-linear data structure is a tree.
Data structures may also be classified as homogenous and non- homogenous data structures. An
Array is a homogenous structure in which all elements are of same type. In non-homogenous
structures the elements may or may not be of the same type. Records are common example of
non-homogenous data structures.
Another way of classifying data structures is as static or dynamic data structures. Static
structures are ones whose sizes and structures associated memory location are fixed at compile
time. Dynamic structures are ones, which expand or shrink as required during the program
execution and their associated memory locations change. Records are a common example of
non-homogenous data structures.
12
A CLASSIFICATION OF DATA STRUCTURES
Data structures are very important in computer systems. In a program, every variable is of some
explicitly or implicitly defined data structure, which determines the set of operations that are
legal upon that variable. The data structures that we discuss here are termed logical data
structures. There may be several different physical representations on storage possible for each
logical data structure. For each data structure that we consider, several possible mappings to
storage will be introduced.
Table 1 below categorizes some of the data structures that are discussed in this book. Some are
primitive: that is, they are not composed of other data structures, examples are: integers,
booleans, and characters. Other data structures can be constructed from one or more primitives.
The simple data structures built from primitives are strings, arrays, and records. Many
programming languages support these data structures.
Simple data structures can be combined in various ways to form more complex structures. The
two fundamental kinds of more complex data structures are linear and nonlinear, depending on
the complexity of the logical relationships they represent. The linear data structures that we will
discuss include stacks, queues, and linear linked lists. The nonlinear data structures include trees
and graphs. We will find that there are many types of tree structures that are useful in
information systems.
File Organizations
13
The data structuring techniques applied to collections of data that are managed as "black boxes"
by operating systems are commonly called file organizations. A file carries a name, contents, a
location where it is kept, and some administrative information, for example, who owns it and
how big it is. The four basic kinds of file organization are sequential, relative, indexed
sequential, and multikey file organizations. These organizations determine how the contents of
these are structured. They are built on the data structuring techniques.
Table 1
14