SlideShare a Scribd company logo
Chapter One
Introduction to Elementary Data Structures
Get started …
Outlines
Motivations
Design goals
Algorithms
Asymptotic Analysis
Heap
Hashing
Motivations
 To enhances the performance of processor, which affect the security, scalability
and reusability the computer system
 To solve the important problems such as sorting, searching,, graph problems,
Combinational problems, are basic motivations for designing algorithm
Design Goal
 Solving problem with multiple constraints (problem size performance and cost in terms of space and time)
 To design fast, efficient and effective solution to a problem domain.
 The study of algorithm is to design efficient algorithm not only limited in reducing cost and time but to
enhance scalability, reliability and availability
The main concern of this course:
 Correctness of the solutions
 Decomposition of application into small and clear units which can be maintained precisely
 Improving the performance of application
Definition of Algorithm
 is a sequence of computational steps that transform the input into the output.
 is a sequence of operations performed on data that have to be organized in the data structures.
 A finite set of instruction that specify a sequence of operations to solve a specific problem
 is a step-by-step procedure to perform a specific task within finite number of steps.
Characteristics of Algorithms
 Input: Must take an input.
 Output: Must give some output (yes/no value etc.)
 Definiteness: each instruction is clear and unambiguous.
 Finiteness: algorithm terminates after a finite number of steps.
 Effectiveness: every instruction must be basic i.e. simple instruction. (N.B: It is not enough that each
operation be definite, but it must also be feasible).
Performance of a program
 Amount of computer memory and time needed to run a program.
 We use two approaches to determine the performance of a program:
 Analytical methods for performance analysis
 Experimental methods for performance measurement that needs to conduct experiments.
Algorithm Analysis Concepts
 AA refers to the process of determining the amount of computing time and storage space required by
different algorithms.
 Its a process of predicting the resource requirement of algorithms in a given environment.
 In order to solve a problem, there are many possible algorithms. Some are:
1. choose the best algorithm for the problem.
2. To classify data structures and algorithms as good (analyzing in terms of resource requirement).
The main resources are Running Time, and Memory Usage
Complexity Analysis
 It is the systematic study of the cost of computation, measured either in time units or in the amount of
storage space required.
 The goal is to have a meaningful measure that permits comparison of algorithms independent of operating
platform.
 Time Complexity: is the amount of computer time it needs from run to completion.
Complexity Analysis …
Space Complexity: The space complexity of a program is the amount of memory it needs to run to completion.
• The space need by a program has the following components:
 Instruction space: is the space needed to store the compiled version of the program instructions.
 The amount of instructions space that is needed depends on factors such as:
 The compiler used to complete the program into machine code.
 The compiler options in effect at the time of compilation
Complexity Analysis …
Data space: is the space needed to store all constant and variable values.
 Data space has two components:
 Space needed by constants and simple variables in program.
 Space needed by dynamically allocated objects such as arrays and class instances.
Environment stack space: is used to save information needed to resume execution of partially
completed functions.
Expectation from an algorithm
 Correctness: Algorithms must produce correct result.
 Less resource usage: Algorithms should use less resources (time and space).
Measures of Times
 The function f(n), gives the running time of an algorithm, depends not only on the size “n‟ of the input data
but also on the particular data.
 The complexity function f(n) for certain cases are:
 Best Case: The minimum possible value of f(n) is called the best case.
 Average Case: The expected value of f(n).
 Worst Case: The maximum value of f(n) for any key possible input.
Asymptotic Analysis
• is concerned with how the running time of an algorithm increases with the size of the input in the limit, as the
size of the input increases without bound.
 Big-Oh Notation (O),
 Big-Omega Notation (W), and
 Big-Theta Notation (Q) are the rate of growth.
Big–OH (O)
 f(n) = O(g(n)), (pronounced order of or big oh), says that the growth rate of f(n) is less than or equal (<) that
of g(n).
Big–OMEGA (W)
 f(n) = W(g(n)) (pronounced omega), says that the growth rate of f(n) is greater than or equal to (>) that of
g(n).
Big–THETA ()
• f(n) = Q(g(n)) (pronounced theta), says that the growth rate of f(n) equals (=) the growth rate of g(n) [if f(n) =
O(g(n)) and T(n) = W (g(n)].
Heap
• Heap is a special tree-based data structure in which the tree is a complete binary tree.
• Heap has the property of:
 Max-Heap: the key present at the root node must be greatest among the keys present at all of its children.
 Min-Heap: the key present at the root node must be minimum among the keys present at all of its children.
Applications of Heaps
 Heapsort sorting algorithm
 Graph algorithms like Prim’s MST and Dijkstra’s Shortest path algorithm
 Priority queue
Implementations
 Creating nodes in memory and link them I tree structure (min-heap)
Implementations …
• Arranging the heap elements in an array structure (min-heap)
• The representation is done as:
1. The root element will be at A[0]
2. Below table shows indexes of other nodes for the ith node:
A[(2*i)+1] returns the LEFT child node
A[(2*i)+2] returns the RIGHT child node
Implementations …
Operations using Heap
getMin(): it returns the root element of Min-Heap. Time complexity is O(1).
getMax(): it returns the root element of Max-Heap. Time complexity is O(1).
extractMin(): removes the minimum element from min-heap. Time complexity is O(logn)
extractMax(): removes the maximum element from max-heap. Time complexity is O(logn)
Operations using Heap …
insert(): inserting a new key takes O(logn).
If new key is greater than its parent, then we don’t need to do anything; otherwise, we need to
traverse up to fix the violated heap property.
delete(): Deleting a key takes O(logn).
heapify(): is the process of creating a heap data structure from a binary tree.
 heapify used to create Min-Heap or Max-Heap.

More Related Content

PPTX
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
PPTX
Chapter 1 Data structure.pptx
PPTX
Intro to DS.pptx
PPTX
Introduction to Data Structure and algorithm.pptx
PDF
U nit i data structure-converted
PDF
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
PPT
Introduction to data structures and Algorithm
PPT
Introduction to data structures and Algorithm
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
Chapter 1 Data structure.pptx
Intro to DS.pptx
Introduction to Data Structure and algorithm.pptx
U nit i data structure-converted
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
Introduction to data structures and Algorithm
Introduction to data structures and Algorithm

Similar to Chapter one Department Computer Science (20)

PPT
Cupdf.com introduction to-data-structures-and-algorithm
PPS
Data Structures and Algorithms Unit 01
PPTX
Design and Analysis of Algorithms.pptx
PPTX
Analysis of Algorithm full version 2024.pptx
PPTX
Design Analysis of Alogorithm 1 ppt 2024.pptx
DOCX
Data structure notes for introduction, complexity
PPT
Lec1
PPTX
Data structure introduction
PPTX
AoA Lec Design of algorithm spresentation
PPT
Introduction to Data Structures Sorting and searching
PDF
Introduction to data structure and algorithm
PPTX
Unit 1, ADA.pptx
PDF
Unit 1 OF DS FOR AI DS BTRCH OF DS FOR AI DS BTRCH .pdf
PPT
chapter 1
PPTX
DataSructure-Time and Space Complexity.pptx
PPTX
algorithmanalysisinfundamentalsofdatastructure-190810085243.pptx
PPTX
Chapter 1 - Introduction to data structure.pptx
PPTX
Chapter 1 Data structure _Algorithms.pptx
Cupdf.com introduction to-data-structures-and-algorithm
Data Structures and Algorithms Unit 01
Design and Analysis of Algorithms.pptx
Analysis of Algorithm full version 2024.pptx
Design Analysis of Alogorithm 1 ppt 2024.pptx
Data structure notes for introduction, complexity
Lec1
Data structure introduction
AoA Lec Design of algorithm spresentation
Introduction to Data Structures Sorting and searching
Introduction to data structure and algorithm
Unit 1, ADA.pptx
Unit 1 OF DS FOR AI DS BTRCH OF DS FOR AI DS BTRCH .pdf
chapter 1
DataSructure-Time and Space Complexity.pptx
algorithmanalysisinfundamentalsofdatastructure-190810085243.pptx
Chapter 1 - Introduction to data structure.pptx
Chapter 1 Data structure _Algorithms.pptx
Ad

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
PDF
SAP855240_ALP - Defining the Global Template PUBLIC.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
cuic standard and advanced reporting.pdf
PDF
Omni-Path Integration Expertise Offered by Nor-Tech
PDF
DevOps & Developer Experience Summer BBQ
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
Electronic commerce courselecture one. Pdf
PDF
Modernizing your data center with Dell and AMD
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Smarter Business Operations Powered by IoT Remote Monitoring
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
MYSQL Presentation for SQL database connectivity
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
SAP855240_ALP - Defining the Global Template PUBLIC.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
cuic standard and advanced reporting.pdf
Omni-Path Integration Expertise Offered by Nor-Tech
DevOps & Developer Experience Summer BBQ
Chapter 3 Spatial Domain Image Processing.pdf
GamePlan Trading System Review: Professional Trader's Honest Take
Electronic commerce courselecture one. Pdf
Modernizing your data center with Dell and AMD
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Smarter Business Operations Powered by IoT Remote Monitoring
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
Ad

Chapter one Department Computer Science

  • 1. Chapter One Introduction to Elementary Data Structures
  • 2. Get started … Outlines Motivations Design goals Algorithms Asymptotic Analysis Heap Hashing
  • 3. Motivations  To enhances the performance of processor, which affect the security, scalability and reusability the computer system  To solve the important problems such as sorting, searching,, graph problems, Combinational problems, are basic motivations for designing algorithm
  • 4. Design Goal  Solving problem with multiple constraints (problem size performance and cost in terms of space and time)  To design fast, efficient and effective solution to a problem domain.  The study of algorithm is to design efficient algorithm not only limited in reducing cost and time but to enhance scalability, reliability and availability
  • 5. The main concern of this course:  Correctness of the solutions  Decomposition of application into small and clear units which can be maintained precisely  Improving the performance of application
  • 6. Definition of Algorithm  is a sequence of computational steps that transform the input into the output.  is a sequence of operations performed on data that have to be organized in the data structures.  A finite set of instruction that specify a sequence of operations to solve a specific problem  is a step-by-step procedure to perform a specific task within finite number of steps.
  • 7. Characteristics of Algorithms  Input: Must take an input.  Output: Must give some output (yes/no value etc.)  Definiteness: each instruction is clear and unambiguous.  Finiteness: algorithm terminates after a finite number of steps.  Effectiveness: every instruction must be basic i.e. simple instruction. (N.B: It is not enough that each operation be definite, but it must also be feasible).
  • 8. Performance of a program  Amount of computer memory and time needed to run a program.  We use two approaches to determine the performance of a program:  Analytical methods for performance analysis  Experimental methods for performance measurement that needs to conduct experiments.
  • 9. Algorithm Analysis Concepts  AA refers to the process of determining the amount of computing time and storage space required by different algorithms.  Its a process of predicting the resource requirement of algorithms in a given environment.  In order to solve a problem, there are many possible algorithms. Some are: 1. choose the best algorithm for the problem. 2. To classify data structures and algorithms as good (analyzing in terms of resource requirement). The main resources are Running Time, and Memory Usage
  • 10. Complexity Analysis  It is the systematic study of the cost of computation, measured either in time units or in the amount of storage space required.  The goal is to have a meaningful measure that permits comparison of algorithms independent of operating platform.  Time Complexity: is the amount of computer time it needs from run to completion.
  • 11. Complexity Analysis … Space Complexity: The space complexity of a program is the amount of memory it needs to run to completion. • The space need by a program has the following components:  Instruction space: is the space needed to store the compiled version of the program instructions.  The amount of instructions space that is needed depends on factors such as:  The compiler used to complete the program into machine code.  The compiler options in effect at the time of compilation
  • 12. Complexity Analysis … Data space: is the space needed to store all constant and variable values.  Data space has two components:  Space needed by constants and simple variables in program.  Space needed by dynamically allocated objects such as arrays and class instances. Environment stack space: is used to save information needed to resume execution of partially completed functions.
  • 13. Expectation from an algorithm  Correctness: Algorithms must produce correct result.  Less resource usage: Algorithms should use less resources (time and space).
  • 14. Measures of Times  The function f(n), gives the running time of an algorithm, depends not only on the size “n‟ of the input data but also on the particular data.  The complexity function f(n) for certain cases are:  Best Case: The minimum possible value of f(n) is called the best case.  Average Case: The expected value of f(n).  Worst Case: The maximum value of f(n) for any key possible input.
  • 15. Asymptotic Analysis • is concerned with how the running time of an algorithm increases with the size of the input in the limit, as the size of the input increases without bound.  Big-Oh Notation (O),  Big-Omega Notation (W), and  Big-Theta Notation (Q) are the rate of growth.
  • 16. Big–OH (O)  f(n) = O(g(n)), (pronounced order of or big oh), says that the growth rate of f(n) is less than or equal (<) that of g(n).
  • 17. Big–OMEGA (W)  f(n) = W(g(n)) (pronounced omega), says that the growth rate of f(n) is greater than or equal to (>) that of g(n).
  • 18. Big–THETA () • f(n) = Q(g(n)) (pronounced theta), says that the growth rate of f(n) equals (=) the growth rate of g(n) [if f(n) = O(g(n)) and T(n) = W (g(n)].
  • 19. Heap • Heap is a special tree-based data structure in which the tree is a complete binary tree. • Heap has the property of:  Max-Heap: the key present at the root node must be greatest among the keys present at all of its children.  Min-Heap: the key present at the root node must be minimum among the keys present at all of its children.
  • 20. Applications of Heaps  Heapsort sorting algorithm  Graph algorithms like Prim’s MST and Dijkstra’s Shortest path algorithm  Priority queue
  • 21. Implementations  Creating nodes in memory and link them I tree structure (min-heap)
  • 22. Implementations … • Arranging the heap elements in an array structure (min-heap) • The representation is done as: 1. The root element will be at A[0] 2. Below table shows indexes of other nodes for the ith node: A[(2*i)+1] returns the LEFT child node A[(2*i)+2] returns the RIGHT child node
  • 24. Operations using Heap getMin(): it returns the root element of Min-Heap. Time complexity is O(1). getMax(): it returns the root element of Max-Heap. Time complexity is O(1). extractMin(): removes the minimum element from min-heap. Time complexity is O(logn) extractMax(): removes the maximum element from max-heap. Time complexity is O(logn)
  • 25. Operations using Heap … insert(): inserting a new key takes O(logn). If new key is greater than its parent, then we don’t need to do anything; otherwise, we need to traverse up to fix the violated heap property. delete(): Deleting a key takes O(logn). heapify(): is the process of creating a heap data structure from a binary tree.  heapify used to create Min-Heap or Max-Heap.