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)
Linear Search
Given an array of
Best Case:
Worst Case:
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:
Example:
Given
Choosing
Therefore,