Introduction to Algorithms

ADT (Abstract Data Type):

  • Specifies what data values it can hold
  • Specifies what operations can be performed on it

Data Structure: How we organize data in memory

Array Operations: Inserting, deleting, searching, traversing

Basic Operations

Unified Computational Model: Each basic operation takes constant time (1 unit)

Given an array of elements, check if is present by examining each element.

Best Case: (element found at first position)

Worst Case: (element at end or not present)

Average Case:


Asymptotic Analysis of Algorithms

Asymptotic analysis describes how an algorithm behaves as input size increases.


Time Complexity Notations

Example:

Big-O Notation

Definition: if there exist positive constants and such that:

Example:

Given , we want to show

Choosing and :

Therefore,