2. Introduction
• Data structure is a specific way to store and
organize data in a computer's memory so that
these data can be used efficiently later.
• A well-designed data structure allows a variety
of critical operations to be performed, using as
few resources, both execution time and
memory space, as possible.
3. Data Models Require
• Firstly, it must be loaded enough in structure
to reflect the actual relationships of the data
with the real world object.
• Secondly, the formation should be simple
enough so that anyone can efficiently process
the data each time it is necessary.
4. Data Structures Address
• First, how the data will be stored, and
• Second, what operations will be performed on
it.
• Thirdly, ensure that the data structure is
independent of its implementation.
5. Definition
• A data structure is a collection of data,
organized so that items can be stored and
retrieved by some fixed techniques, or
• A data structure is a data organization,
management, and storage format that enables
efficient access and modification.
6. Foundation Terms Of A Data Structure
• Interface − Each data structure has an interface
which represents the set of operations that a
data structure supports. It provides the list of
supported operations, type of parameters they
can accept and return type of these operations.
• Implementation − Implementation provides
the internal representation of a data structure
and the definition of the algorithms used in the
operations of the data structure.
7. Characteristics of a Data Structure
Correctness − Data structure implementation
should implement its interface correctly.
Time Complexity − Running time or the
execution time of operations of data structure
must be as small as possible.
Space Complexity − Memory usage of a data
structure operation should be as little as
possible.
8. Classification of Data Structures:
Data structures can be classified as
• Simple data structure
• Compound data structure
9. Simple Data Structure:
• Simple data structure can be constructed with
the help of primitive data structure.
• A primitive data type is built into a language,
for example;
• integer,
• real,
• character,
• and Boolean.
10. Compound Data structure:
• Can be constructed with the help of any one
of the primitive data structure and should
have a specific functionality. It can be
designed by user.
• Classified into:
Linear data structure
Non-linear data structure
11. Linear Data Structure:
• A data structure is said to be linear if its elements
combine to form any specific order. There are
basically two techniques of representing such linear
structure within memory.
• Linear data structures can be constructed as a
continuous arrangement of data elements in the
memory.
• In the linear Data Structures the relationship of
adjacency is maintained between the data elements.
12. Models of Linear Data Structures
· Arrays: First way is to provide the linear
relationships among all the elements
represented by means of linear memory
location.
· linked lists: The second technique is to
provide the linear relationship among all the
elements represented by using the concept of
pointers or links.
14. Array
• Array is a container which can hold a fix
number of items and these items should be of
the same type. Most of the data structures
make use of arrays to implement their
algorithms.
15. Linked Lists
• A linked list is a sequence of data structures,
which are connected together via links.
Linked List is a sequence of links which
contains items. Each link contains a
connection to another link. Linked list is the
second most-used data structure after array.
16. Non-linear Data Structure:
• Non-linear data structure can be constructed as a
collection of randomly distributed set of data item
joined together by using a special pointer (tag).
• The relationship of adjacency is not maintained
between the data items.
• Mostly used for representing data that contains a
hierarchical relationship among various elements.
• Examples:
Graphs
family of trees
17. Abstract Data Type: (ADT)
• ADT, is a logical description of how we view the data
and the operations that are allowed without regard to
how they will be implemented.
• An ADT is a mathematical model of a data structure
that specifies the type of data stored, the operations
supported on them, and the types of parameters of
the operations.
• An ADT specifies what each operation does, but not
how it does it. Typically, an ADT can be implemented
using one of many different data structures.
18. Choose Of The Right Data Structures
• Begins from the choice of an abstract data type
(ADT)
• Identify the interface of operations supported
by a data structure
• Determine the efficiency of the data structure:
how much space does the data structure occupy
• Estimate the running times of the operations in
its interface
19. When selecting a data structure to solve a
problem
1 Analyze your problem to determine the basic
operations that must be supported. ...
2 Quantify the resource constraints for each
operation.
3 Select the data structure that best meets
these requirements.