0% found this document useful (0 votes)
12 views

Analysis and Design of Algorithms: - An Algorithm Is A Method of Solving Problem (On A Computer) - Problem Example

This document provides an overview of an algorithms course. It discusses algorithm analysis and design, including example problems like finding the closest pair of points. It describes common algorithmic techniques like divide-and-conquer, greedy algorithms, and dynamic programming. The course will cover combinatorial problems, computational complexity, and data structures. Students will complete homework problem sets, projects, and exams. Homework 1 is due and includes problems on sorting algorithms and their analysis.

Uploaded by

lini ickpnn
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Analysis and Design of Algorithms: - An Algorithm Is A Method of Solving Problem (On A Computer) - Problem Example

This document provides an overview of an algorithms course. It discusses algorithm analysis and design, including example problems like finding the closest pair of points. It describes common algorithmic techniques like divide-and-conquer, greedy algorithms, and dynamic programming. The course will cover combinatorial problems, computational complexity, and data structures. Students will complete homework problem sets, projects, and exams. Homework 1 is due and includes problems on sorting algorithms and their analysis.

Uploaded by

lini ickpnn
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 10

Analysis and Design of

Algorithms
An algorithm is a method of solving problem
(on a computer)
Problem example:
given a set of points on the plane
find the closest pair

Algorithm:
find distance between all pairs

Can we do it faster?

Combinatorial Problems
Closest pair
O(n^2) algorithm

TSP
O(n!) algorithm
too slow
difficult problem

Course Overview
General algorithmic methods
divide and conquer, greedy algorithms, dynamic
programming

Data structures
hashing, priority queues, binary search trees, binomial
heaps

Combinatorial problems
MST, TSP, Vertex/Set Cover, Matrix

Computational Complexity
NP-completeness, reducibility, approximation

Cormen-Leiserson-Rivest
Introduction to Algorithms

Grading
Home work

1/3

problems from Cormen ...


two programming assignments

4 Quizes
4520 Final
6520 Project

1/3
1/3
1/3

Home Work
Problem sets
weekly
handed in/out Tuesdays (usually)
Extra-credit problems!

Due next Tuesday


1.4-1 p.17 / 1.2-2 p.13
1.4-2 p.17 / 1.2-2 p.13

Sorting
Input: sequence of numbers
Output: a sorted sequence
Insertion-Sort
for j = 2 to n do
current=A[j]
i=j-1
while i > 0 & A[i] > current do
A[i + 1] = A[i]
i=i-1

A[i + 1] = current

a1 , a2 ,..., an
a1 a2 ... an

How it works
Insertion-Sort
for j = 2 to n do
current = A[j]
i=j-1
while i > 0 A[i] & A[i] > current do
A[i + 1] = A[i]
i=i-1

A[i + 1] = current

next current
go left
find place for current
shift sorted right
go left

put current in place

Running Time
Depends on
input size
input quality (partially ordered)

Kinds of analysis
Worst case (standard)
Average case (sometimes)
Best case
(never)

Asymptotic Analysis

Ignore machine dependent constants


Look at growth of T(n) while n
O - notation
O(n^3)>O(n^2)

Insertion Sort Analysis

Worst Case O(n^2)


Average Case O(n^2)
Can we do better?
New paradigms

You might also like