0% found this document useful (0 votes)
11 views

MSA Data Structure Presentation

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

MSA Data Structure Presentation

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

DATA STRUCTURE

Dr. Mohammed Shafeeq Ahmed


PRESENTATION OUTLINE
 Introduction
 What is data structure
 Definition of data structure
 Types of data structure
 Primitive and Non primitive data structure
 Linear and Non linear data structure
 Operations on data structure
Introduction
Computer is an electronic machine which is used for data processing
and manipulation.

When programmer collects such type of input data for processing, It is


require to store all of them in computers main memory.

In order to store data in the computer, we need to know


• Representation of data in computer.
• Accessing of data.
• How to solve problem step by step.

For doing all of this task we used Data Structure


 Data: Collection of raw facts.

 Data structure is representation of the


logical relationship existing between
individual elements of data.

 A data structure is a specialized format


for organizing, processing, retrieving
and storing data.

 In computer programming, a data


structure may be selected or designed
to store data for the purpose of working
on it with various algorithms.
What is Data Structure
Data Structure can be defined as the group of data elements which provides
an efficient way of storing and organizing data in the computer so that it can
be used efficiently.
examples are arrays, Linked List, Stack, Queue, etc.
Data Structures are widely used in almost every aspect of Computer Science
i.e. Operating System, Compiler Design, Artificial intelligence, Graphics and
many more.
Data Structures are the main part of many computer science algorithms as
they enable the programmers to handle the data in an efficient way.
It plays a vital role in enhancing the performance of a software or a program
as the main function of the software is to store and retrieve the user’s data as
fast as possible
Data Structure
◦ A data structure is a particular way of organizing data in a computer so that
it can be used effectively.
◦ For example, we can store a list of items having the same data-type using
the array data structure.

◦ The representation of particular data structure in the main memory of a


computer is called as storage structure.
◦ The storage structure representation in auxiliary memory is called as file
structure.
Data Structure mainly specifies the following things:
1)Organization of data
2)Accessing method
3) Processing alternative for information

Program = Algorithm + Data Structure

Point to be remember in Data Structure


1) Amount of memory require to store
2) Amount of time require to process
3) Representation of data in memory
4) Operations performs on data
Types Of Data Structure
◦ The Data structure are mainly divided into two types:
1) Primitive Data structure also called as Built in Data structure.
There are basic structure and directly operated upon by the machine level
instructions.
 Integer: which allows all values without fraction part. Store whole numbers.
 Float: It is a data type which is use for storing fraction numbers.
 Character: It is a data type which is used for character storage.
 Pointer: A variable that hold memory address of another variable are called
pointer.
◦ The most commonly used operation on data structure are broadly
categorized into following types:
◦ Create, Selection, Update, Delete
2) Non primitive Data structure also called as User Defined Data structure.
◦ The non-primitive data structure emphasize on structuring a group of homogeneous
(same type) or heterogeneous (different type) data items.
◦ It is divided into two type i.e., Linear & Non Linear Data structure.
1)Linear Data structure
A linear data structure simply means that it is a storage format of the data in the
memory in which the data are arranged in contiguous blocks of memory.
 Arrays: It is a fixed size sequenced collection of elements stored in contiguous
memory locations.
 Linked Lists: It is a collection of nodes, each containing an element and a reference
to the next node.
 Stacks: Insertion and deletion operations are performed at one end only, (LIFO)
order. Using Push and Pop Operation.
 Queues: Insertion at one and deletion at another end, (FIFO) order. Using Front and
Rear End Operation.
2) Non linear Data structure
Non-linear data structures is a form of data structure where the data
elements are not arranged in linearly or sequentially.
Elements are stored in a hierarchical or a network-based structure that does
not follow a sequential order.
Operations: searching, insertion, and deletion of element.

TREE: It is a finite data items (nodes) in which data items are arranged in
branches and sub branches. Tree represent the hierarchical relationship
between various elements.

Graph: It is a collection of nodes (information) and connecting edges (Logical


relation) between nodes.
1) Simple 2) Mixed 3) Multi 4) Directed 5) Un-directed graph
Operation on Data Structures
1. Create: This operation results in reserving memory for program elements. This can be
done by declaration statement Creation of DS may take place either during compile-
time or run-time.
2. Destroy: This operation destroy memory space allocated for specified data structure .
3. Selection: This operation deals with accessing a particular data within a data
structure.
4. Updating: It updates or modifies the data in the data structure.
5. Searching: It finds the presence of desired data item in the list of data items, it may
also find locations of all elements that satisfy certain conditions.
6. Sorting: This is a process of arranging all data items in a DS in particular order, for
example either ascending order or in descending order.
7. Merging: It is a process of combining data items of two different sorted list into single
sorted list.
8. Traversing: It is a process of visiting each and every node of a list in systematic
manner.
Thank You
Abstract Data Type (ADT)

ADT is a collection of data and a set of operations that can be performed on


the data.

◦ It enables us to think abstractly about the data.


◦ We can separate concepts from implementation.
◦ Typically, we choose a data structure and algorithms that provide an
implementation of an ADT.
◦ Example of Linear data structure are Stack and Queue
Stack
◦ Stack is a data structure in which insertion and deletion
operations are performed at one end only.
◦ The insertion operation is referred to as ‘PUSH’ and deletion
is referred as ‘POP’ operation
◦ Stack is also called as Last In First Out (LIFO) data structure.
Queue
◦ The data structure which permits the insertion at one and
deletion at another end, known as Queue.
◦ End at which deletion is occurs is known as FRONT end and
another end at which insertion occurs is known as REAR
end.
◦ Queue is also called as First In First Out (FIFO)
Non-Linear Data Structure
◦ Non linear DS are those data structure in which data items are not arranged
in a sequence.
◦ Example on Non Linear DS are Tree and Graph.
TREE
◦ A Tree can be define as finite data items (nodes) in which data items are
arranged in branches and sub branches
◦ Tree represent the hierarchical relationship between various elements
◦ Tree consist of nodes connected by edge, the represented by circle and edge
Components of Graph lives connecting to circle.
Graph
◦ Graph is collection of nodes (information) and connecting edges (Logical
relation) between nodes.
◦ A tree can be viewed as restricted graph
◦ Graph have many types: 1) Simple graph 2) Mixed graph 3) Multi graph 4)
Directed graph 5) Un-directed graph
Difference Between Linear and Non Linear Data Structure

Linear Data Structure Non – Linear Data Structure

◦ Every item is related to its previous and next ◦ Every item is attached with many other items.
item. ◦ Data is not arranged in sequence.
◦ Data is arranged in linear sequence.
◦ Data cannot be traversed in a single run.
◦ Data items can be traversed in a single run
◦ E.g. Tree, Graph
◦ E.g. Array, Stacks, Linked list, Queue
◦ Implementation is difficult.
◦ Implementation is easy.
Operation on Data Structures
Design of efficient data structure must take operations to be performed on the DS into account. The most commonly
used operations on DS are broadly categorized into following types

1. Create: This operation results in reserving memory for program elements. This can be done by declaration
statement Creation of DS may take place either during compile-time or run-time.
2. Destroy: This operation destroy memory space allocated for specified data structure .
3. Selection: This operation deals with accessing a particular data within a data structure.
4. Updation: It updates or modifies the data in the data structure.
5. Searching: It finds the presence of desired data item in the list of data items, it may also find locations of all
elements that satisfy certain conditions.
6. Sorting: This is a process of arranging all data items in a DS in particular order, for example either ascending order
or in descending order.
7. Splitting: It is a process of partitioning single list to multiple list.
8. Merging: It is a process of combining data items of two different sorted list into single sorted list.
9. Traversing: It is a process of visiting each and every node of a list in systematic manner.
What are Arrays?

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.
•Following are the important terms
to understand the concept of
Array.
Element − Each item stored
in an array is called an element.
1. An array is a container of elements. Index − Each location of an
2. Elements have a specific value and data type, like "ABC", TRUE or FALSE, etc. element in an array has a
3. Each element also has its own index, which is used to access the element. numerical index, which is used to
identify the element.
• Elements are stored at
contiguous memory locations.
• An index is always less than
the total number of array
items.
• In terms of syntax, any
variable that is declared as an
array can store multiple
values.
• Almost all languages have the
same comprehension of
arrays but have different
ways of declaring and
initializing them.
• However, three parts will
• Array name: necessary for easy reference to the collection of elements always remain common in all
• Data Type: necessary for type checking and data integrity
the initializations, i.e., array
• Elements: these are the data values present in an array
name, elements, and the data
type of elements.
How to access a
specific array
value?
You can access any array item by
using its index

Syntax
arrayName[indexNum]

Example
balance[1]

Here, we have accessed the second value of the array using its index, which is 1.
The output of this will be 200, which is basically the second value of the balance
array.
◦ Array Representation
◦ Arrays can be declared in various ways in different languages. For illustration, let's take C array declaration.

You might also like