Docsity

ALGORITHM AND DESIGN ANALYSIS, Study notes of Design and Analysis of Algorithms

Partial preview of the text

Download ALGORITHM AND DESIGN ANALYSIS and more Study notes Design and Analysis of Algorithms in PDF only on Docsity!

Unit-

Dr. Obulaporam Gireesha

Introduction + Divide and Conquer Introduction

  • (^) Algorithm
  • (^) Performance Analysis
    • Space & Time Complexity
  • (^) Asymptotic Notations
    • Big oh notation
    • Omega notation
    • Theta notation
    • Little oh notation Divide and Conquer
      • (^) General Method
      • (^) Applications
        • Binary Search
        • Quick Sort
        • Merge Sort
        • Strassen’s Matrix Multiplication This slides consists of only about “Introduction” part (i.e., Part-1 of Unit-1)
  • (^) Informally, Sequence an algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output. A sequence of computational steps that transform the input into the output. Input Comput er Output Problem Algorithm What is Algorithm? (Cont…)

What is Algorithm? (Cont…)

  • (^) Definition [Algorithm]. An algorithm is a finite set of instructions that,
  • (^) if followed, accomplishes a particular task.
  • (^) In addition, all algorithms must satisfy the following criteria:

Specified in

1. English

2. Flowchart

3. Programming

Language

4. Combination of

above

  • (^) There are four distinct areas of study one can identify are as follows: 1. How to devise algorithms 2. How to validate algorithms 3. How to analyze algorithms 4. How to test a program: Debugging & ProfilingDebugging  process of executing programs on sample data sets to determine whether faulty results occur and, if so, to correct them  Profiling  process of executing a correct program on datasets and measuring the time and space it takes to What is Algorithm? (Cont…)
  • What is Algorithm? (Cont…)

What is Algorithm? (Cont…)

What is Algorithm? (Cont…)

What is Algorithm? (Cont…)

There are many criteria upon which we can judge an algorithm. Forinstance: 1.Does it do what we want it to do? 2.Does it work correctly according to the original specifications of the task? 3.Is there documentation that describes how to use it and how it works? 4.Are procedures created in such a way that they perform logical subfunctions? 5.Is the code readable?

  • (^) These criteria are all vitally important when it comes to writing software, most especially for large systems.
  • (^) There are other criteria for judging algorithms that have a more direct relationship to performance. These have to do with their computing time and storage requirements. Performance Analysis
  • Example: Performance Analysis (Cont…) 1. A – Array 2. n – Size 3. Result 4. i Here, “n, result & I” are fixed length variables. So, 1 unit each total-3 units Array depends on ‘n’. So it has ‘n’ units Therefore, total size is “n+3”
  • Example: Performance Analysis (Cont…) 1. a – Array (Variable Length); size of ‘a’ depends on ‘n’ 2. a[n] – 1 unit (Fixed length) 3. Rsum(a, n-1)s – 1 unit (Fixed length) 4. Return (store value) – 1 unit (Fixed length) Total space complexity is “3*(n+1)” units

Time complexity:  (^) For Algorithm Heading: 0  (^) For Braces: 0  (^) For Expression: 1  (^) For any Looping Statement: Number of time the loop is repetive Performance Analysis (Cont…)