📘

Definition and Characteristics of Algorithms

Jul 21, 2024

Definition and Characteristics of Algorithms

What is an Algorithm?

  • A finite set of steps to solve a particular problem.
  • Can be written in any programming language (C, Java, Python) or in layman terms as steps.
  • Example: Sum of two numbers
    • Step 1: Read A
    • Step 2: Read B
    • Step 3: Sum = A + B
    • Step 4: Print Sum

Characteristics of an Algorithm

  1. Finite Steps
    • Must contain a finite number of steps/instructions.
    • Each instruction should take a finite amount of time.
  2. Unambiguous
    • Instructions should be clear and unambiguous.
    • Use relevant and correct symbols.
  3. Analysis
    • Process of comparing two algorithms.
    • Involves constraints like time, space, number of registers, and network bandwidth.
    • Most important parameters: Time and Space.

Types of Analysis

  1. Priory Analysis
    • Analysis before execution.
    • Independent of hardware.
    • Calculate the number of iterations.
    • Example: Time complexity in terms of iterations.
  2. Posterior Analysis
    • Analysis after execution.
    • Dependent on hardware.
    • Measures exact time taken (e.g., 0.4 seconds).
    • Example: Program execution time varies with hardware.

Comparison of Priory and Posterior Analysis

  • Priory gives an approximate value.
  • Posterior gives an exact value but is hardware-dependent.
  • Priory is preferred due to its hardware independence and uniform values.

Asymptotic Notations

  • Used to represent time complexity.
  • Types:
    • Big O notation
    • Big Omega
    • Theta
    • Small o
    • Small omega

Upcoming Topics

  • Detailed explanation of asymptotic notations in the next video.

Thank you!