Introduction to Data Structures
Early in the course you were introduced to simple data types, like
Each of these data types can be used to create a variety of
A simple data type variable is a location in memory that
value that can be used by a computer program.
Single values are
practical for loop counter variables, maximum number of grades, the height of
and the number of medals won by the United States at the last
Programs that handle passenger airline reservations, student college
transcripts, employee payroll records and hospital patient information, require
massive data storage.
Such major storage requirements cannot be handled
efficiently by thousands of simple data type variables, each storing a single value.
You will need more sophisticated data types.
It can be argued that you have been storing multiple values inside objects since
the very beginning, and that is very true. However, the data stored inside the
classes and objects so far have been one or more simple data types.
many situations where data needs to hold more than one value.
Such a situation
calls for using a
. So what is a data structure?
Look at a building.
Note that it is made up of smaller structures like rooms, halls, stairways, etc.
room is made up of walls, floors, ceilings, desks, chairs, etc.
Another example can be found with animals.
Animals are organisms made up of
Each organ system is made up of
Organs are made up of
, and tissues are made up of
We could continue and work down to
the molecular and atomic level, but for this analogy, assume that the
simplest, lowest level.
The whole point is that the structure, an organism in this
case, is made up of other, smaller structures, until eventually you reach the
These two examples are used to motivate the definition of a data structure.
computer science it really is the same idea.
The only difference in structures is
the nature of the smallest building block used to create the structure.
In an animal
organism it is a cell.
In a building it may be a brick or a plank and in a computer
science data structure it is a simple data type.
First Data Structure Definition