2. Introduction To Data Structure
• Data Structure is a way of collecting and organizing data in such a way
that we can perform operations on these data in an effective way.
• Data Structures is about rendering data elements in terms of some
relationship, for better organization and storage.
• For example, we have some data which has, Student name “Rohan"
and Roll 20. Here “Rohan" is of String data type and 20 is
of integer data type.
• We can organize this data as a record like Student record, which will
have both name and Roll in it. Now we can collect and store student
records in a file or database as a data structure. For example:
“Mohan" 30”, “Sohan" 31, “Rena" 33 etc.
9/12/2021 Mamta Bhattarai
4. Basic types of Data Structures
Data structure can be categorized into two part:
Built-in Data Structure(Primitive DS): Data structure for which a
language has built-in support are known as Built-in Data Structure: EX
integer, float, .
User define Data structure(Non-Primitive DS): Array, List, stack, Linked
List, stack, Queue, Tree, Graph etc.
9/12/2021 Mamta Bhattarai
5. Characterstic Description
Linear In Linear data structures,the data items are arranged in a linear sequence.
Example: Array
Non-Linear In Non-Linear data structures,the data items are not in sequence.
Example: Tree, Graph
Homogeneous In homogeneous data structures,all the elements are of same type. Example: Array
Non-Homogeneous In Non-Homogeneous data structure, the elements may or may not be of the same
type. Example: Structures
Static Static data structures are those whose sizes and structures associated memory
locations are fixed, at compile time. Example: Array
Dynamic Dynamic structures are those which expands or shrinks depending upon the program
need and its execution. Also, their associated memory locations changes.
Example: Linked List created using pointers
9/12/2021 Mamta Bhattarai
6. Abstract Data Type(ADT)
• The abstract datatype is special kind of datatype, whose behavior is
defined by a set of values and set of operations.
• The keyword “Abstract” is used as we can use these datatypes, we
can perform different operations. But how those operations are
working that is totally hidden from the user.
• The ADT is made of with primitive datatypes, but operation logics are
hidden.
• Some examples of ADT are Stack, Queue, List etc.
9/12/2021 Mamta Bhattarai
7. Importance and advantages of DS
• Data Structures are the key part of many computer algorithms as they allow the
programmers to do data management in an efficient way.
• A right selection of data structure can enhance the efficiency of computer
program or algorithm in a better way.
• Why Data Structures are needed
• With increasing complexities in computer algorithms, the amount of data usage is
increasing, this can affect the performance of the application and can create
some areas of concern:
• Processing speed: To handle very large data, high-speed processing is required,
but with growing data, processor may fail to achieve required processing speed.
• Data Search: Getting a particular record from database should be quick and with
optimum use of resources.
• Multiple requests: To handle simultaneous requests from multiple users
9/12/2021 Mamta Bhattarai
8. Data Structure Advantages
• Efficient Memory use: With efficient use of data structure memory usage
can be optimized, for e.g we can use linked list vs arrays when we are not
sure about the size of data. When there is no more use of memory, it can
be released.
• Reusability: Data structures can be reused, i.e. once we have implemented
a particular data structure, we can use it at any other place.
Implementation of data structures can be compiled into libraries which can
be used by different clients.
• Abstraction: Data structure serves as the basis of abstract data types, the
data structure defines the physical form of ADT(Abstract Data Type). ADT is
theoretical and Data structure gives physical form to them.
9/12/2021 Mamta Bhattarai