SlideShare a Scribd company logo
Introduction to
Data Structure and Algorithm
Presented By: Pratik Mota
Objectives
 Basics of Data Structure and Algorithm
 Practical Examples of where Data Structure Algorithms is used
 Asymptotic Notations [ O(n), o(n), θ(n), Ω(n), ω(n) ]
 Time and Space Complexity
 GNU gprof basic
Basics of Data structure and Algorithm
 Data structure is a particular way of storing and organizing data in a computer so that it can be
used efficiently.
 Some Well-know Data structure
1) Array
2) List [Singly and Doubly Linked List]
3) Tree [ Binary,AVL, Red Black..etc ]
4) B+ Tree
5) Heap [ Max and Min Heap ]
6) Hashing
7) Graph [ BFS, DFS,..etc ]
Basics of Data structure and Algorithm
Algorithm is a step-by-step procedure for calculations OR you can tell it is sequence of
program instructions designed to compute a particular result.
 Examples:- Sorting, Searching, Shortest Path, Dynamic Programming, Numerical Algorithms
etc..
Sort
INPUT
sequence of numbers
a1, a2, a3,….,an
b1,b2,b3,….,bn
OUTPUT
a permutation of the
sequence of numbers
2 5 4 10 7 2 4 5 7 10
Sorting Algorithm
Use of Data Structure and Algorithm
Practical Examples (Cont.)
Practical Examples (Cont.)
Asymptotic Notations
1n
2n
3n
4n
5n
6n
Runningtime
1 2 3 4 5 6 7 8 9 10 11 12 …..
best-case Ω(n)
average-case θ(n)
worst-case O(n)
Input instance size
o(n)
ω(n)
Basics of Complexity
O(1) < O(log n ) < O(n) < O(n log n ) < O(n^2) < ….. < O(n^k) < O(2^n)
O( n^2 + n + 1 ) => O(n^2)  MAX ( f(n), g(n) )
 O(N + a)^b  O(N^b)
Time Complexity :- Amount of time taken by an algorithm to run.
Space Complexity:- Extra/Temporary Space use by algorithm .
Time and Space Complexity
O(n) O(n^2) O( log n )
GNU gprof
 Gprof is a profiling program which collects performance statistics of our programs.
 For Performance analysis -pg option needed for GCC / g++ Compiler.
Ex:- g++ -pg gprof_test.cpp -o gprof_test
 After running ./gprof_test , It generates gmon.out file.
 gmon.out file contain Performance analysis statistics, which can be analyze using
gprof tool. Ex:- gprof gprof_test gmon.out > analysis.txt
 It provides mainly two type of Performance Analysis
1) Flat Profile [ Total amount of time your program spent executing each function ]
2) Call graph [ How much time was spent in each function and its children ]
Introduction to datastructure and algorithm
Ad

More Related Content

What's hot (20)

Turing Test in Artificial Intelligence.pptx
Turing Test in Artificial Intelligence.pptxTuring Test in Artificial Intelligence.pptx
Turing Test in Artificial Intelligence.pptx
RSAISHANKAR
 
Python programming : Files
Python programming : FilesPython programming : Files
Python programming : Files
Emertxe Information Technologies Pvt Ltd
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms I
Mohamed Loey
 
Python basics
Python basicsPython basics
Python basics
Hoang Nguyen
 
Python tuple
Python   tuplePython   tuple
Python tuple
Mohammed Sikander
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
tanmaymodi4
 
Turing test
Turing testTuring test
Turing test
SHAKIB MONDAL
 
Relation matrix & graphs in relations
Relation matrix &  graphs in relationsRelation matrix &  graphs in relations
Relation matrix & graphs in relations
Rachana Pathak
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
Mohd Sajjad
 
Object oriented programming in python
Object oriented programming in pythonObject oriented programming in python
Object oriented programming in python
baabtra.com - No. 1 supplier of quality freshers
 
Data types in python
Data types in pythonData types in python
Data types in python
Learnbay Datascience
 
Queue data structure
Queue data structureQueue data structure
Queue data structure
anooppjoseph
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
Jasleen Kaur (Chandigarh University)
 
Data Analysis in Python-NumPy
Data Analysis in Python-NumPyData Analysis in Python-NumPy
Data Analysis in Python-NumPy
Devashish Kumar
 
Complexity analysis in Algorithms
Complexity analysis in AlgorithmsComplexity analysis in Algorithms
Complexity analysis in Algorithms
Daffodil International University
 
Iterarators and generators in python
Iterarators and generators in pythonIterarators and generators in python
Iterarators and generators in python
Sarfaraz Ghanta
 
c++ lab manual
c++ lab manualc++ lab manual
c++ lab manual
Shrunkhala Wankhede
 
Algorithm Complexity and Main Concepts
Algorithm Complexity and Main ConceptsAlgorithm Complexity and Main Concepts
Algorithm Complexity and Main Concepts
Adelina Ahadova
 
Introduction to Data Structure
Introduction to Data Structure Introduction to Data Structure
Introduction to Data Structure
Prof Ansari
 
Stack and Queue
Stack and Queue Stack and Queue
Stack and Queue
Apurbo Datta
 

Viewers also liked (7)

Type research
Type researchType research
Type research
Research Scholar - HNB Garhwal Central University, Srinagar, Uttarakhand.
 
Major Types of Research
Major Types of ResearchMajor Types of Research
Major Types of Research
Tabi Khan
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
Dhaval Kaneria
 
Types of research
Types of researchTypes of research
Types of research
Ashish Sahu
 
Presentation on types of research
Presentation on types of researchPresentation on types of research
Presentation on types of research
Research Scholar - HNB Garhwal Central University, Srinagar, Uttarakhand.
 
Types of Research Designs RS Mehta
Types of Research Designs RS MehtaTypes of Research Designs RS Mehta
Types of Research Designs RS Mehta
BP KOIRALA INSTITUTE OF HELATH SCIENCS,, NEPAL
 
Definition and types of research
Definition and types of researchDefinition and types of research
Definition and types of research
fadifm
 
Ad

Similar to Introduction to datastructure and algorithm (20)

19 algorithms-and-complexity-110627100203-phpapp02
19 algorithms-and-complexity-110627100203-phpapp0219 algorithms-and-complexity-110627100203-phpapp02
19 algorithms-and-complexity-110627100203-phpapp02
Muhammad Aslam
 
Lec1
Lec1Lec1
Lec1
Nikhil Chilwant
 
Stack squeues lists
Stack squeues listsStack squeues lists
Stack squeues lists
James Wong
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Tony Nguyen
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Luis Goldster
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Harry Potter
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Young Alista
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
Stacksqueueslists
Fraboni Ec
 
19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity
Intro C# Book
 
Data Structures and Agorithm: DS 22 Analysis of Algorithm.pptx
Data Structures and Agorithm: DS 22 Analysis of Algorithm.pptxData Structures and Agorithm: DS 22 Analysis of Algorithm.pptx
Data Structures and Agorithm: DS 22 Analysis of Algorithm.pptx
RashidFaridChishti
 
C++ Notes PPT.ppt
C++ Notes PPT.pptC++ Notes PPT.ppt
C++ Notes PPT.ppt
Alpha474815
 
lecture1.ppt
lecture1.pptlecture1.ppt
lecture1.ppt
SagarDR5
 
Profiling and optimization
Profiling and optimizationProfiling and optimization
Profiling and optimization
g3_nittala
 
Analysis of Algorithum
Analysis of AlgorithumAnalysis of Algorithum
Analysis of Algorithum
Ain-ul-Moiz Khawaja
 
Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...
Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...
Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...
TechVision8
 
19. algorithms and-complexity
19. algorithms and-complexity19. algorithms and-complexity
19. algorithms and-complexity
showkat27
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
Venkatesh Iyer
 
Annotations.pdf
Annotations.pdfAnnotations.pdf
Annotations.pdf
GauravKumar295392
 
Lec7
Lec7Lec7
Lec7
TejaswiEnugurthi
 
Lec7.ppt
Lec7.pptLec7.ppt
Lec7.ppt
NikhilKatariya8
 
19 algorithms-and-complexity-110627100203-phpapp02
19 algorithms-and-complexity-110627100203-phpapp0219 algorithms-and-complexity-110627100203-phpapp02
19 algorithms-and-complexity-110627100203-phpapp02
Muhammad Aslam
 
Stack squeues lists
Stack squeues listsStack squeues lists
Stack squeues lists
James Wong
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Tony Nguyen
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Harry Potter
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Young Alista
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
Stacksqueueslists
Fraboni Ec
 
19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity
Intro C# Book
 
Data Structures and Agorithm: DS 22 Analysis of Algorithm.pptx
Data Structures and Agorithm: DS 22 Analysis of Algorithm.pptxData Structures and Agorithm: DS 22 Analysis of Algorithm.pptx
Data Structures and Agorithm: DS 22 Analysis of Algorithm.pptx
RashidFaridChishti
 
C++ Notes PPT.ppt
C++ Notes PPT.pptC++ Notes PPT.ppt
C++ Notes PPT.ppt
Alpha474815
 
lecture1.ppt
lecture1.pptlecture1.ppt
lecture1.ppt
SagarDR5
 
Profiling and optimization
Profiling and optimizationProfiling and optimization
Profiling and optimization
g3_nittala
 
Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...
Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...
Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...
TechVision8
 
19. algorithms and-complexity
19. algorithms and-complexity19. algorithms and-complexity
19. algorithms and-complexity
showkat27
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
Venkatesh Iyer
 
Ad

Recently uploaded (20)

Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509
Fermin Galan
 
Beyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraftBeyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraft
Dmitrii Ivanov
 
GC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance EngineeringGC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance Engineering
Tier1 app
 
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
Ranking Google
 
Exchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv SoftwareExchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv Software
Shoviv Software
 
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studiesTroubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Tier1 app
 
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World ExamplesMastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
jamescantor38
 
Wilcom Embroidery Studio Crack Free Latest 2025
Wilcom Embroidery Studio Crack Free Latest 2025Wilcom Embroidery Studio Crack Free Latest 2025
Wilcom Embroidery Studio Crack Free Latest 2025
Web Designer
 
Time Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project TechniquesTime Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project Techniques
Livetecs LLC
 
[gbgcpp] Let's get comfortable with concepts
[gbgcpp] Let's get comfortable with concepts[gbgcpp] Let's get comfortable with concepts
[gbgcpp] Let's get comfortable with concepts
Dimitrios Platis
 
Autodesk Inventor Crack (2025) Latest
Autodesk Inventor    Crack (2025) LatestAutodesk Inventor    Crack (2025) Latest
Autodesk Inventor Crack (2025) Latest
Google
 
Unit Two - Java Architecture and OOPS
Unit Two  -   Java Architecture and OOPSUnit Two  -   Java Architecture and OOPS
Unit Two - Java Architecture and OOPS
Nabin Dhakal
 
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb ClarkDeploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Peter Caitens
 
Robotic Process Automation (RPA) Software Development Services.pptx
Robotic Process Automation (RPA) Software Development Services.pptxRobotic Process Automation (RPA) Software Development Services.pptx
Robotic Process Automation (RPA) Software Development Services.pptx
julia smits
 
Artificial hand using embedded system.pptx
Artificial hand using embedded system.pptxArtificial hand using embedded system.pptx
Artificial hand using embedded system.pptx
bhoomigowda12345
 
What Do Candidates Really Think About AI-Powered Recruitment Tools?
What Do Candidates Really Think About AI-Powered Recruitment Tools?What Do Candidates Really Think About AI-Powered Recruitment Tools?
What Do Candidates Really Think About AI-Powered Recruitment Tools?
HireME
 
Digital Twins Software Service in Belfast
Digital Twins Software Service in BelfastDigital Twins Software Service in Belfast
Digital Twins Software Service in Belfast
julia smits
 
Adobe Media Encoder Crack FREE Download 2025
Adobe Media Encoder  Crack FREE Download 2025Adobe Media Encoder  Crack FREE Download 2025
Adobe Media Encoder Crack FREE Download 2025
zafranwaqar90
 
Wilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For WindowsWilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For Windows
Google
 
Top Magento Hyvä Theme Features That Make It Ideal for E-commerce.pdf
Top Magento Hyvä Theme Features That Make It Ideal for E-commerce.pdfTop Magento Hyvä Theme Features That Make It Ideal for E-commerce.pdf
Top Magento Hyvä Theme Features That Make It Ideal for E-commerce.pdf
evrigsolution
 
Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509
Fermin Galan
 
Beyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraftBeyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraft
Dmitrii Ivanov
 
GC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance EngineeringGC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance Engineering
Tier1 app
 
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
Ranking Google
 
Exchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv SoftwareExchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv Software
Shoviv Software
 
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studiesTroubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Tier1 app
 
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World ExamplesMastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
jamescantor38
 
Wilcom Embroidery Studio Crack Free Latest 2025
Wilcom Embroidery Studio Crack Free Latest 2025Wilcom Embroidery Studio Crack Free Latest 2025
Wilcom Embroidery Studio Crack Free Latest 2025
Web Designer
 
Time Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project TechniquesTime Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project Techniques
Livetecs LLC
 
[gbgcpp] Let's get comfortable with concepts
[gbgcpp] Let's get comfortable with concepts[gbgcpp] Let's get comfortable with concepts
[gbgcpp] Let's get comfortable with concepts
Dimitrios Platis
 
Autodesk Inventor Crack (2025) Latest
Autodesk Inventor    Crack (2025) LatestAutodesk Inventor    Crack (2025) Latest
Autodesk Inventor Crack (2025) Latest
Google
 
Unit Two - Java Architecture and OOPS
Unit Two  -   Java Architecture and OOPSUnit Two  -   Java Architecture and OOPS
Unit Two - Java Architecture and OOPS
Nabin Dhakal
 
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb ClarkDeploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Peter Caitens
 
Robotic Process Automation (RPA) Software Development Services.pptx
Robotic Process Automation (RPA) Software Development Services.pptxRobotic Process Automation (RPA) Software Development Services.pptx
Robotic Process Automation (RPA) Software Development Services.pptx
julia smits
 
Artificial hand using embedded system.pptx
Artificial hand using embedded system.pptxArtificial hand using embedded system.pptx
Artificial hand using embedded system.pptx
bhoomigowda12345
 
What Do Candidates Really Think About AI-Powered Recruitment Tools?
What Do Candidates Really Think About AI-Powered Recruitment Tools?What Do Candidates Really Think About AI-Powered Recruitment Tools?
What Do Candidates Really Think About AI-Powered Recruitment Tools?
HireME
 
Digital Twins Software Service in Belfast
Digital Twins Software Service in BelfastDigital Twins Software Service in Belfast
Digital Twins Software Service in Belfast
julia smits
 
Adobe Media Encoder Crack FREE Download 2025
Adobe Media Encoder  Crack FREE Download 2025Adobe Media Encoder  Crack FREE Download 2025
Adobe Media Encoder Crack FREE Download 2025
zafranwaqar90
 
Wilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For WindowsWilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For Windows
Google
 
Top Magento Hyvä Theme Features That Make It Ideal for E-commerce.pdf
Top Magento Hyvä Theme Features That Make It Ideal for E-commerce.pdfTop Magento Hyvä Theme Features That Make It Ideal for E-commerce.pdf
Top Magento Hyvä Theme Features That Make It Ideal for E-commerce.pdf
evrigsolution
 

Introduction to datastructure and algorithm

  • 1. Introduction to Data Structure and Algorithm Presented By: Pratik Mota
  • 2. Objectives  Basics of Data Structure and Algorithm  Practical Examples of where Data Structure Algorithms is used  Asymptotic Notations [ O(n), o(n), θ(n), Ω(n), ω(n) ]  Time and Space Complexity  GNU gprof basic
  • 3. Basics of Data structure and Algorithm  Data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.  Some Well-know Data structure 1) Array 2) List [Singly and Doubly Linked List] 3) Tree [ Binary,AVL, Red Black..etc ] 4) B+ Tree 5) Heap [ Max and Min Heap ] 6) Hashing 7) Graph [ BFS, DFS,..etc ]
  • 4. Basics of Data structure and Algorithm Algorithm is a step-by-step procedure for calculations OR you can tell it is sequence of program instructions designed to compute a particular result.  Examples:- Sorting, Searching, Shortest Path, Dynamic Programming, Numerical Algorithms etc.. Sort INPUT sequence of numbers a1, a2, a3,….,an b1,b2,b3,….,bn OUTPUT a permutation of the sequence of numbers 2 5 4 10 7 2 4 5 7 10 Sorting Algorithm
  • 5. Use of Data Structure and Algorithm
  • 8. Asymptotic Notations 1n 2n 3n 4n 5n 6n Runningtime 1 2 3 4 5 6 7 8 9 10 11 12 ….. best-case Ω(n) average-case θ(n) worst-case O(n) Input instance size o(n) ω(n)
  • 9. Basics of Complexity O(1) < O(log n ) < O(n) < O(n log n ) < O(n^2) < ….. < O(n^k) < O(2^n) O( n^2 + n + 1 ) => O(n^2)  MAX ( f(n), g(n) )  O(N + a)^b  O(N^b) Time Complexity :- Amount of time taken by an algorithm to run. Space Complexity:- Extra/Temporary Space use by algorithm .
  • 10. Time and Space Complexity O(n) O(n^2) O( log n )
  • 11. GNU gprof  Gprof is a profiling program which collects performance statistics of our programs.  For Performance analysis -pg option needed for GCC / g++ Compiler. Ex:- g++ -pg gprof_test.cpp -o gprof_test  After running ./gprof_test , It generates gmon.out file.  gmon.out file contain Performance analysis statistics, which can be analyze using gprof tool. Ex:- gprof gprof_test gmon.out > analysis.txt  It provides mainly two type of Performance Analysis 1) Flat Profile [ Total amount of time your program spent executing each function ] 2) Call graph [ How much time was spent in each function and its children ]
  翻译: