FDS Session 2

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 17

UNIT 1

INTRODUCTION TO ALGORITHM AND DATA STRUCTURES

Subject: Fundamentals of Data Structures By Prof. Megha Patil.


OUTLOOK
 From Problem to Program (Problem, Solution,
Algorithm, Data Structure and Program).
 Data Structures: Data, Information, Knowledge
 Data structure, Abstract Data Types (ADT)
 Data Structure Classification (Linear and Non-
linear, Static and Dynamic, Persistent and
Ephemeral data structures).
PROBLEM, SOLUTION, ALGORITHM, DATA STRUCTURE AND PROGRAM

 Data
 Data Structure
 Problem
 Algorithm
 Information
 Knowledge
Abstract Data Type (ADT):
 Basic Built in Data Type not Sufficient.
 Need to define own Data Type.

 ADT refers to defining own Data Type which is defined by Programmer not by
Language.

 Basically it is Model for certain Data Structure.


 ADT is just model , ADT does not specify concrete implementation .
 ADT defines basic behavior.
Queue As ADT..
Data Structure:
 Data: Simply a Value or set of Values of different Types like Integer, Character, Float.

Structure: A way of organizing information so that it can be used in easier way.

In Simple words, Data Structure is a way of organizing data in such


a way so that data can be easier to use.
Data Structure Classification:

 Linear Category 1 Based upon Organization of Data Items


 Non-linear

 Static
Category 2 Based upon Existence
 Dynamic

 Persistent
Category 3
 Ephemeral
Data Structure Classification:

Derived from Primitive Data Structures


Inbuilt or Can be Directly Accessed
More Complicated
through m/c Instructions

Linear Data Structure Vs. Non- Linear Data Structure


Linear Vs. Non- Linear

 Linear: Data items are ordered Sequentially or Linearly one after another.
 Traversing: one after another. So Accessing Last element is headache.
 Memory Allocation: Linear
 Homogeneous Data can be stored
 Examples: Array, Linked List, Stack Queue.

Array
Linear Vs. Non- Linear
 Linear: Data items are not ordered Sequentially or Linearly one after another.
 Traversing: Cannot be traversed in single run.
 Memory Allocation: Non-Linear
 Examples: Graphs, Trees.

Trees Graphs
Static:
 Size of the Structure is fixed.
Dynamic:
 Size of the Structure is Varies Runtime.
Data Structure Classification:

Data Structure

Persistent Ephemeral
Persistent Data Structure :

 Always preserves the previous version of itself when it is modified.


 Examples:
1. Linked List Concatenation.
2. Binary Search Tree Insertion.

Types

Partially persistent Fully Persistent


Linked List Concatenation:
Binary Search Tree Insertion:

You might also like