1.2 Introduction To Algorithms
1.2 Introduction To Algorithms
Lecture 1
Introduction to Algorithms
Analysis
Problem
specification
Design
Algorithm
Implementation
Program
Compilation
Executable
(solution)
C Program
University Institute of Engineering (UIE)
Computational problems
Serial
Parallel
Recursive
Logical
Deterministic/Non-Deterministic
Exact/Appropriate
Insertion Merge
Sort Takes C1 n2 time to sort
n elements.
Sort Takes C2 n lg n time to
sort n elements.
Faster than Merge Sort Faster than Insertion
for small input size. Sort for large input size.
Note: Insertion Sort usually has a smaller constant factor than Merge Sort. C1< C2
Problem is to sort an array of 1 million numbers (106)