Chapter-1. Introduction To Data Structure
Chapter-1. Introduction To Data Structure
We study data structures to learn to write more efficient programs. But what is the point of
programs being efficient when new computers are faster day by day? Because the more we are
capable of excellence, the more our ambition grows. And to tackle that, we need to learn to
represent and operate data more efficiently. By studying data structures, we will be able to store
and use data more efficiently. In this chapter, we are going to explore the meaning of data structure
as well as learn what different types of data structures there are.
1.4 Algorithm
So far we have learned about what it means to be a data structure and several kinds of it. We also
learned about their operations and such. Now, everything is well and fine but it would not make
much of a sense to have all these data structures that we cannot use if you do not know what a
program is. But before we dive into knowing that, we will first visit another term called an
algorithm.
An algorithm simply means a set of instructions that can be followed to perform a task. In
other words, the sequence of steps that can be followed to solve a problem. To solve a problem in
a programming language, we first deduce an algorithm about it. To write an algorithm we do not
strictly follow the grammar of any particular programming language. However, its language may
be near to a programming language. Every algorithm can be divided into three sections:
The first section is the input section, where we show which data elements are to be
given or fed to the algorithm as an input.
The second section is the most important one, which is the operational or processing
section. Here we have to do all necessary operations, such as computation, taking a
decision, calling other procedures (or algorithms), etc.
The third section is output, where we display or get the result with the help of the
previous two sections.
1.5 Program
Now that we know about algorithms, it is much easier for us to learn what a program constitutes.
It is basically, the sequence of instructions of any programming language that can be followed to
perform a task. This definition is quite similar to the one of an algorithm. The key difference is,
now we are limiting the solution of a problem to be devised using a programming language. That
means, we now have to follow a certain programming language’s syntax and semantics. Otherwise,
we cannot call it a program.
Like an algorithm, a program also has three sections: input, processing, and output. In a
program usually, we use a large amount of data. Most of the cases these data are not only
elementary items, but there also exists a structural relationship among them. That means a program
uses data structures.
1.6 Exercises
Answer the following questions:
1. What is a data structure? Explain with examples.
2. What is Abstract Data Types (ADTs)? Explain with examples.
3. What do you mean by the terms algorithm and program? What are their differences?
Explain with appropriate examples.
1.7 References
“Data Structures and Algorithm Analysis”, Edition 3.2 (C++ Version), Clifford A. Shaffer.
https://en.wikipedia.org/wiki/Data_structure