SlideShare a Scribd company logo
2
Most read
12
Most read
13
Most read
Introduction to Data Structure
and Algorithms
8/11/20181
Data Structures
8/11/20182
It is set of procedures to define, store, access and
manipulate data.
or
The organized collection of data is called data
structure.
or
The logical or mathematical model of a particular
organization of data is called data structure.
Types of Data Structure
 Physical Data Structures
The data structures that have actually or physically
same space in memory are called physical data
structures
o For example, one dimensional array
 Logical Data Structures
The data structures which are treated, defined and
stored in their logical picture
o For example, Boolean data type
8/11/20183
8/11/20184
Types of Data Structures
 Primitive(Elementary Data Types)
The data types which are processed or manipulated
as a single whole(i.e., alone). They are also called built-in
data types.
o Example, integer, real, character etc.
 Non-Primitive(Structure Data Types)
The items which are collection of other data
structures are called non-primitive items. If more than
one values are combined in the single name is called non-
primitive data structures
o Example, Arrays, Stack, Queues etc
8/11/20185
Types of Non-Primitive Data Structures
 Linear Data Structures
The DS in which there is concept of linearity b/w
the components is called linear data structure. The
components exists in a certain sequence one after
another. They have some successor or predecessor
o Example, Arrays, Stack, Queues etc.
 Non Linear Data Structures
The data structure in which the order of data
structure does not matter and is not fixed.
o Example Tree, Graph
8/11/20186
Algorithms
An algorithm is a well-defined list of steps for solving
a particular problem.
The efficiency of an algorithm depends on space and
time.
Characteristics of Algorithms
The main characteristics of algorithms are as follows:
 Algorithms must have a unique name
 Algorithms should have explicitly defined set of inputs
and outputs
 Algorithms are well-ordered with unambiguous
operations
 Algorithms halt in a finite amount of time. Algorithms
should not run for infinity, i.e., an algorithm must end at
some point
8/11/20187
Algorithm Efficiency
 algorithmic efficiency is a property of an algorithm which
relates to the number of computational resources used by
the algorithm.
 For maximum efficiency we wish to minimize resource
usage. However, the various resources (e.g. time, space)
cannot be compared directly, so which of two algorithms is
considered to be more efficient often depends on which
measure of efficiency is considered the most important, e.g.
the requirement for high speed, minimum memory usage
8/11/20188
9
• Let’s look at the following algorithm for initializing the values in
an array:
final int N = 500;
int [] counts = new int[N];
for (int i=0; i<counts.length; i++)
counts[i] = 0;
• The length of time the algorithm takes to execute depends on the
value of N.
• In that algorithm, we have one loop that processes all of the
elements in the array.
• Intuitively:
– If N was half of its value, we would expect the algorithm to
take half the time
– If N was twice its value, we would expect the algorithm to
take twice the time
• That is true and we say that the algorithm efficiency relative to N
is linear.
8/11/2018
10
• Let’s look at another algorithm for initializing the values in a
different array:
final int N = 500;
int [] [] counts = new int[N][N];
for (int i=0; i<N; i++)
for (int j=0; j<N; j++)
counts[i][j] = 0;
• The length of time the algorithm takes to execute still depends on the
value of N.
• However, in the second algorithm, we have two nested loops to
process the elements in the two dimensional array
• Intuitively:
– If N is half its value, we would expect the algorithm to take one
quarter the time.
– If N is twice its value, we would expect the algorithm to take
quadruple the time.
• That is true and we say that the algorithm efficiency relative to N is
quadratic.
8/11/2018
Time Complexity
 It’s a function describing the amount of time required to
run an algorithm in terms of the size of the input. "Time"
can mean the number of memory accesses performed, the
number of comparisons between integers, the number of
times some inner loop is executed, or some other natural
unit related to the amount of real time the algorithm will
take.
 Time complexity of an algorithm signifies the total time
required by the program to run till its completion.
 Worst-case − The maximum number of steps taken on any
instance of size a.
 Best-case − The minimum number of steps taken on any
instance of size a.
 Average case − An average number of steps taken on any
instance of size a.
8/11/201811
Space Complexity
 Space complexity is a function describing the amount of
memory (space) an algorithm takes in terms of the
amount of input to the algorithm.
 We often speak of extra memory needed, not counting the
memory needed to store the input itself. Again, we use
natural (but fixed-length) units to measure this.
 We can use bytes, but it's easier to use, say, the number of
integers used, the number of fixed-sized structures, etc.
 In the end, the function we come up with will be
independent of the actual number of bytes needed to
represent the unit.
 Space complexity is sometimes ignored because the space
used is minimal and/or obvious, however sometimes it
becomes as important issue as time complexity
8/11/201812
Asymptotic Notation
 Execution time of an algorithm depends on the instruction set,
processor speed, disk I/O speed, etc. Hence, we estimate the
efficiency of an algorithm asymptotically.
 Time function of an algorithm is represented by T(n), where n
is the input size.
 Different types of asymptotic notations are used to represent
the complexity of an algorithm. Following asymptotic
notations are used to calculate the running time complexity of
an algorithm.
 O − Big Oh
 Ω − Big omega
 θ − Big theta
 o − Little Oh
 ω − Little omega
Examples:
• 3 * n2 + n/2 + 12 ∈ O(n2)
• 4*n*log2(3*n+1) + 2*n-1 ∈ O(n * log n)
8/11/201813

More Related Content

PPT
Data Structures and Algorithm Analysis
Mary Margarat
 
PPT
DATA STRUCTURE AND ALGORITHMS
removed_8057d320f6c8601c14a895598b86eacb
 
PPT
Data Structure and Algorithms
ManishPrajapati78
 
PPTX
Algorithm Complexity and Main Concepts
Adelina Ahadova
 
PPTX
Data Structure and Algorithms
iqbalphy1
 
PPT
Introduction to Data Structures Sorting and searching
Mvenkatarao
 
PPTX
Complexity analysis in Algorithms
Daffodil International University
 
PDF
Data Structures Notes 2021
Sreedhar Chowdam
 
Data Structures and Algorithm Analysis
Mary Margarat
 
DATA STRUCTURE AND ALGORITHMS
removed_8057d320f6c8601c14a895598b86eacb
 
Data Structure and Algorithms
ManishPrajapati78
 
Algorithm Complexity and Main Concepts
Adelina Ahadova
 
Data Structure and Algorithms
iqbalphy1
 
Introduction to Data Structures Sorting and searching
Mvenkatarao
 
Complexity analysis in Algorithms
Daffodil International University
 
Data Structures Notes 2021
Sreedhar Chowdam
 

What's hot (20)

PDF
Elementary data structure
Biswajit Mandal
 
PPTX
Presentation on Elementary data structures
Kuber Chandra
 
PPTX
Quick sort
Afaq Mansoor Khan
 
PDF
Algorithms Lecture 4: Sorting Algorithms I
Mohamed Loey
 
PPTX
Non Linear Data Structures
Adarsh Patel
 
DOC
Time and space complexity
Ankit Katiyar
 
PPT
Dinive conquer algorithm
Mohd Arif
 
PPTX
Data structure and algorithm using java
Narayan Sau
 
PDF
linear search and binary search
Zia Ush Shamszaman
 
PPTX
daa-unit-3-greedy method
hodcsencet
 
PPT
Data structures using c
Prof. Dr. K. Adisesha
 
PPTX
Linear Search Presentation
Markajul Hasnain Alif
 
PDF
Array data structure
maamir farooq
 
PPTX
Mathematical Analysis of Recursive Algorithm.
mohanrathod18
 
PPTX
Polynomial reppresentation using Linkedlist-Application of LL.pptx
Albin562191
 
PPTX
Asymptotic notations
Nikhil Sharma
 
PPTX
Data Structures and Algorithm - Module 1.pptx
EllenGrace9
 
PPTX
linked list in data structure
shameen khan
 
PPTX
Tree - Data Structure
Ashim Lamichhane
 
Elementary data structure
Biswajit Mandal
 
Presentation on Elementary data structures
Kuber Chandra
 
Quick sort
Afaq Mansoor Khan
 
Algorithms Lecture 4: Sorting Algorithms I
Mohamed Loey
 
Non Linear Data Structures
Adarsh Patel
 
Time and space complexity
Ankit Katiyar
 
Dinive conquer algorithm
Mohd Arif
 
Data structure and algorithm using java
Narayan Sau
 
linear search and binary search
Zia Ush Shamszaman
 
daa-unit-3-greedy method
hodcsencet
 
Data structures using c
Prof. Dr. K. Adisesha
 
Linear Search Presentation
Markajul Hasnain Alif
 
Array data structure
maamir farooq
 
Mathematical Analysis of Recursive Algorithm.
mohanrathod18
 
Polynomial reppresentation using Linkedlist-Application of LL.pptx
Albin562191
 
Asymptotic notations
Nikhil Sharma
 
Data Structures and Algorithm - Module 1.pptx
EllenGrace9
 
linked list in data structure
shameen khan
 
Tree - Data Structure
Ashim Lamichhane
 
Ad

Similar to Introduction to data structure and algorithms (20)

PPTX
Modile-1-PPT-1-BCAC0207-AlgorithmDesign.pptx
ryadavrohit26
 
PPTX
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
AntareepMajumder
 
PPTX
Module 1 notes of data warehousing and data
vijipersonal2012
 
PPTX
Data structure and algorithm
Trupti Agrawal
 
PDF
Theory of algorithms final
Dgech
 
PDF
U nit i data structure-converted
Shri Shankaracharya College, Bhilai,Junwani
 
PDF
Unit 1 OF DS FOR AI DS BTRCH OF DS FOR AI DS BTRCH .pdf
prathamsingh33
 
PPT
Basics of data structure types of data structures
kavita20193
 
PPTX
TIME EXECUTION OF DIFFERENT SORTED ALGORITHMS
Tanya Makkar
 
PPTX
Unit i basic concepts of algorithms
sangeetha s
 
PDF
DATA STRUCTURE
RobinRohit2
 
PDF
DATA STRUCTURE.pdf
ibrahim386946
 
PPTX
data structures using C 2 sem BCA univeristy of mysore
ambikavenkatesh2
 
PPTX
DATA STRUCTURES unit 1.pptx
ShivamKrPathak
 
PPT
Data Structure and Algorithm chapter two, This material is for Data Structure...
bekidea
 
PPTX
Design and Analysis of Algorithms.pptx
Syed Zaid Irshad
 
PPTX
02 Introduction to Data Structures & Algorithms.pptx
mettlehenry573
 
PPT
Introduction to data structures and Algorithm
Dhaval Kaneria
 
PPT
Introduction to data structures and Algorithm
Dhaval Kaneria
 
PPT
Cupdf.com introduction to-data-structures-and-algorithm
TarikuDabala1
 
Modile-1-PPT-1-BCAC0207-AlgorithmDesign.pptx
ryadavrohit26
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
AntareepMajumder
 
Module 1 notes of data warehousing and data
vijipersonal2012
 
Data structure and algorithm
Trupti Agrawal
 
Theory of algorithms final
Dgech
 
U nit i data structure-converted
Shri Shankaracharya College, Bhilai,Junwani
 
Unit 1 OF DS FOR AI DS BTRCH OF DS FOR AI DS BTRCH .pdf
prathamsingh33
 
Basics of data structure types of data structures
kavita20193
 
TIME EXECUTION OF DIFFERENT SORTED ALGORITHMS
Tanya Makkar
 
Unit i basic concepts of algorithms
sangeetha s
 
DATA STRUCTURE
RobinRohit2
 
DATA STRUCTURE.pdf
ibrahim386946
 
data structures using C 2 sem BCA univeristy of mysore
ambikavenkatesh2
 
DATA STRUCTURES unit 1.pptx
ShivamKrPathak
 
Data Structure and Algorithm chapter two, This material is for Data Structure...
bekidea
 
Design and Analysis of Algorithms.pptx
Syed Zaid Irshad
 
02 Introduction to Data Structures & Algorithms.pptx
mettlehenry573
 
Introduction to data structures and Algorithm
Dhaval Kaneria
 
Introduction to data structures and Algorithm
Dhaval Kaneria
 
Cupdf.com introduction to-data-structures-and-algorithm
TarikuDabala1
 
Ad

Recently uploaded (20)

PDF
July 2025: Top 10 Read Articles Advanced Information Technology
ijait
 
PDF
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
PDF
top-5-use-cases-for-splunk-security-analytics.pdf
yaghutialireza
 
PPTX
Introduction of deep learning in cse.pptx
fizarcse
 
PDF
Zero carbon Building Design Guidelines V4
BassemOsman1
 
PPTX
AgentX UiPath Community Webinar series - Delhi
RohitRadhakrishnan8
 
PPT
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
PDF
Packaging Tips for Stainless Steel Tubes and Pipes
heavymetalsandtubes
 
DOCX
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
PPTX
22PCOAM21 Data Quality Session 3 Data Quality.pptx
Guru Nanak Technical Institutions
 
PDF
Top 10 read articles In Managing Information Technology.pdf
IJMIT JOURNAL
 
PDF
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
PPT
SCOPE_~1- technology of green house and poyhouse
bala464780
 
PDF
Introduction to Data Science: data science process
ShivarkarSandip
 
PDF
The Effect of Artifact Removal from EEG Signals on the Detection of Epileptic...
Partho Prosad
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PPTX
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
PPTX
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
PDF
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
PDF
Unit I Part II.pdf : Security Fundamentals
Dr. Madhuri Jawale
 
July 2025: Top 10 Read Articles Advanced Information Technology
ijait
 
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
top-5-use-cases-for-splunk-security-analytics.pdf
yaghutialireza
 
Introduction of deep learning in cse.pptx
fizarcse
 
Zero carbon Building Design Guidelines V4
BassemOsman1
 
AgentX UiPath Community Webinar series - Delhi
RohitRadhakrishnan8
 
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
Packaging Tips for Stainless Steel Tubes and Pipes
heavymetalsandtubes
 
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
22PCOAM21 Data Quality Session 3 Data Quality.pptx
Guru Nanak Technical Institutions
 
Top 10 read articles In Managing Information Technology.pdf
IJMIT JOURNAL
 
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
SCOPE_~1- technology of green house and poyhouse
bala464780
 
Introduction to Data Science: data science process
ShivarkarSandip
 
The Effect of Artifact Removal from EEG Signals on the Detection of Epileptic...
Partho Prosad
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
Unit I Part II.pdf : Security Fundamentals
Dr. Madhuri Jawale
 

Introduction to data structure and algorithms

  • 1. Introduction to Data Structure and Algorithms 8/11/20181
  • 2. Data Structures 8/11/20182 It is set of procedures to define, store, access and manipulate data. or The organized collection of data is called data structure. or The logical or mathematical model of a particular organization of data is called data structure.
  • 3. Types of Data Structure  Physical Data Structures The data structures that have actually or physically same space in memory are called physical data structures o For example, one dimensional array  Logical Data Structures The data structures which are treated, defined and stored in their logical picture o For example, Boolean data type 8/11/20183
  • 5. Types of Data Structures  Primitive(Elementary Data Types) The data types which are processed or manipulated as a single whole(i.e., alone). They are also called built-in data types. o Example, integer, real, character etc.  Non-Primitive(Structure Data Types) The items which are collection of other data structures are called non-primitive items. If more than one values are combined in the single name is called non- primitive data structures o Example, Arrays, Stack, Queues etc 8/11/20185
  • 6. Types of Non-Primitive Data Structures  Linear Data Structures The DS in which there is concept of linearity b/w the components is called linear data structure. The components exists in a certain sequence one after another. They have some successor or predecessor o Example, Arrays, Stack, Queues etc.  Non Linear Data Structures The data structure in which the order of data structure does not matter and is not fixed. o Example Tree, Graph 8/11/20186
  • 7. Algorithms An algorithm is a well-defined list of steps for solving a particular problem. The efficiency of an algorithm depends on space and time. Characteristics of Algorithms The main characteristics of algorithms are as follows:  Algorithms must have a unique name  Algorithms should have explicitly defined set of inputs and outputs  Algorithms are well-ordered with unambiguous operations  Algorithms halt in a finite amount of time. Algorithms should not run for infinity, i.e., an algorithm must end at some point 8/11/20187
  • 8. Algorithm Efficiency  algorithmic efficiency is a property of an algorithm which relates to the number of computational resources used by the algorithm.  For maximum efficiency we wish to minimize resource usage. However, the various resources (e.g. time, space) cannot be compared directly, so which of two algorithms is considered to be more efficient often depends on which measure of efficiency is considered the most important, e.g. the requirement for high speed, minimum memory usage 8/11/20188
  • 9. 9 • Let’s look at the following algorithm for initializing the values in an array: final int N = 500; int [] counts = new int[N]; for (int i=0; i<counts.length; i++) counts[i] = 0; • The length of time the algorithm takes to execute depends on the value of N. • In that algorithm, we have one loop that processes all of the elements in the array. • Intuitively: – If N was half of its value, we would expect the algorithm to take half the time – If N was twice its value, we would expect the algorithm to take twice the time • That is true and we say that the algorithm efficiency relative to N is linear. 8/11/2018
  • 10. 10 • Let’s look at another algorithm for initializing the values in a different array: final int N = 500; int [] [] counts = new int[N][N]; for (int i=0; i<N; i++) for (int j=0; j<N; j++) counts[i][j] = 0; • The length of time the algorithm takes to execute still depends on the value of N. • However, in the second algorithm, we have two nested loops to process the elements in the two dimensional array • Intuitively: – If N is half its value, we would expect the algorithm to take one quarter the time. – If N is twice its value, we would expect the algorithm to take quadruple the time. • That is true and we say that the algorithm efficiency relative to N is quadratic. 8/11/2018
  • 11. Time Complexity  It’s a function describing the amount of time required to run an algorithm in terms of the size of the input. "Time" can mean the number of memory accesses performed, the number of comparisons between integers, the number of times some inner loop is executed, or some other natural unit related to the amount of real time the algorithm will take.  Time complexity of an algorithm signifies the total time required by the program to run till its completion.  Worst-case − The maximum number of steps taken on any instance of size a.  Best-case − The minimum number of steps taken on any instance of size a.  Average case − An average number of steps taken on any instance of size a. 8/11/201811
  • 12. Space Complexity  Space complexity is a function describing the amount of memory (space) an algorithm takes in terms of the amount of input to the algorithm.  We often speak of extra memory needed, not counting the memory needed to store the input itself. Again, we use natural (but fixed-length) units to measure this.  We can use bytes, but it's easier to use, say, the number of integers used, the number of fixed-sized structures, etc.  In the end, the function we come up with will be independent of the actual number of bytes needed to represent the unit.  Space complexity is sometimes ignored because the space used is minimal and/or obvious, however sometimes it becomes as important issue as time complexity 8/11/201812
  • 13. Asymptotic Notation  Execution time of an algorithm depends on the instruction set, processor speed, disk I/O speed, etc. Hence, we estimate the efficiency of an algorithm asymptotically.  Time function of an algorithm is represented by T(n), where n is the input size.  Different types of asymptotic notations are used to represent the complexity of an algorithm. Following asymptotic notations are used to calculate the running time complexity of an algorithm.  O − Big Oh  Ω − Big omega  θ − Big theta  o − Little Oh  ω − Little omega Examples: • 3 * n2 + n/2 + 12 ∈ O(n2) • 4*n*log2(3*n+1) + 2*n-1 ∈ O(n * log n) 8/11/201813