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

Lec01 PDF

This document provides information about an algorithms analysis course, including: - The course code, credit hours, schedule, prerequisites, and evaluation criteria. - The professor's contact information and recommended textbook. - An introduction to the role of algorithms in computing and some basic algorithmic concepts that will be covered, like complexity analysis, sorting, logarithms, and mathematical induction.

Uploaded by

Ser Marinn
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views

Lec01 PDF

This document provides information about an algorithms analysis course, including: - The course code, credit hours, schedule, prerequisites, and evaluation criteria. - The professor's contact information and recommended textbook. - An introduction to the role of algorithms in computing and some basic algorithmic concepts that will be covered, like complexity analysis, sorting, logarithms, and mathematical induction.

Uploaded by

Ser Marinn
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

2/24/16

Anlisis de Algoritmos
Clave:
No. De horas /semana:
Duracin semanas:
Total de Horas:
No. De crditos:
Prerrequisitos:
Conocimientos previos
Recomendados:

CI7102-T
4
16
4
8
CI7100-T
Programacin

Anlisis de Algoritmos
Profesor:
Email:
Tel:
Web page:
Plataforma:

Dr. Juan Jos Flores Romero


[email protected]
322 3500 ext 4363
dep.fie.umich.mx/~juan
piazza.com/umich.mx/spring2016/ci7102t/home

Lugar:

Sala de usos mltiples


Omega 2
Martes 9-11
Mircoles 9 -11

Horario:
Consultas
Breves:
Largas:

Toca mi puerta
Cita x email

2/24/16

Anlisis de Algoritmos
Evaluacin

4 exmenes
Intro y recurrencia
Ordenamientos
Grafos
Diseo y Anlisis

~50%

3 proyectos
Ordenamientos
Grafos
Diseo y Anlisis

~50%

Participacin

hasta 10%

Anlisis de Algoritmos
Libro:
Introduction to
Algorithms,
Third Edition,
Cormen et al.

2/24/16

The Role of Algorithms in Computing

Algorithm
a sequence of computational steps that transform the input (a set of values) into the output.
a tool for solving a well-defined computational problem

Example: Sorting Problem


Input:

A sequence of n numbers a1, a2, . . . , an

Output:
A permutation (reordering) a1, a2, . . . , an of the input sequence such that a1 a2 an

An algorithm is said to be correct if , for every input instance, it halts with the correct output

What kind of Problems are Solved by Algorithms?

Human Genome Project


3 billion nucleotides. 100K genes are identified using various algorithms including approximate
string matching, searching, sorting, alignment, hashing, clustering, etc. etc.

Enabling Internet
search engines
network routing algorithms
cryptography / network security

Optimal Use of Resources in Business and Life


Examples: optimal placement of oil wells to maximize output, flight scheduling, truck routing,
bin packing, ad placement for political campaigns, chip placement for minimal routing, etc. etc.
Linear Programming

Developing Strategies to Solve Puzzles, Play Mind Games etc.


computer chess, othello, chinese checkers
AI Algorithms

2/24/16

Which one is more important:


advances in hardware speed or improvement in algorithmic complexity?

Computer A: 1011 instructions / sec.


Computer B: 108 instructions / sec.
A is 1000 times faster than B
Insertion Sort:
Merge Sort:

# of instructions to be executed in order to sort n items = 2n2


# of instructions to be executed in order to sort n items = 50 n log10 n

n = 1 million = 106 items

If A uses Insertion sort and


Time A = [2*(106)2 / 1011 ]

B uses merge sort, which one runs faster?

= 20 seconds

Time B = [50*(106) * log10 (106) / 108 ] = 3 seconds!

Basic Concepts - Monotonicity


Monotonic function (Monotone) is a function between
ordered sets that preserves the given order. I.e., nonnegative slope.

2/24/16

Basic Concepts Floor and Ceiling

Floor

Ceiling

Basic Concepts - Polynomials


Polynomial: expression consisting of variables and
coefficients (+, *, non-negative integer exponents).
1-var polynomial: x2 4x + 7.
Multi-var polynomial: x3 + 2xyz2 yz + 1.

2/24/16

Basic Concepts - Logarithms


Logarithm: inverse operation to exponentiation.

Basic Concepts - Factorial

Factorial(n), denoted by n!: product of all positive


integers less than or equal to n.
5! = 5 * 4 * 3 * 2 * 1 = 120

2/24/16

Basic Concepts Fibonacci Numbers

Basic Concepts Fibonacci Numbers

2/24/16

Basic Concepts Sets


A well defined collection of distinct objects

Basic Concepts Sets


Concepts
Membership
Subsets
Power Set
Cardinality
Operations
Union
Intersection
Complement
Cartesian Product

2/24/16

Basic Concepts Relations


A binary relation on sets A and B is a collection of
ordered pairs of elements of A and B. In other words, it
is a subset of the Cartesian product A B

Basic Concepts Functions


A function is a relation between a set of inputs and a set of
outputs. Each input is related to exactly one output.

2/24/16

Basic Concepts Functions

Basic Concepts - Summations

k = 1+ 2 + 3 +!+ n =
k =1
n

n(n + 1)
2

= 12 + 2 2 + 32 + ! + n 2 =

k =1

k 3 = 13 + 23 + 33 + ! + n3 =
k =1

n(n + 1)(2n + 1)
6

n 2 (n + 1) 2
4

xk = 1+ x + x2 + !+ xn =
k =0

If | x |< 1

lim x = x k =
n

k =0

x n+1 1
x 1

k =0

1
1 x

10

2/24/16

Basic Concepts - Summations

(cont.)

Harmonic Series
n

1
1 1
1
= 1 + + + ! = ln n + O(1)
2 3
n
k =1 k

Hn =

k =0

1
1 x

for | x |< 1 (shown earlier)

Take the derivative of both sides and also multiply with x


You get the following series summation :

kx

k =0

x
(1 x) 2

for | x |< 1

Basic Concepts Mathematical Induction


Claim: S(n) is true for all n m
Proof:

Basis: Show formula is true for n = m

Inductive hypothesis:
Assume formula is true for an arbitrary n

Step: Show that formula is then true for n+1

11

2/24/16

Induction Example 1:
n

k = 1+ 2 + 3 +!+ n =

Prove that

k =1

Basis:

Inductive hypothesis:

If n = 1, then

1 =? 1(1+1) / 2

n(n + 1)
for n 1
2

Yes, TRUE

Assume formula is true for n 1 + 2 + 3 + + n = n(n+1) / 2

Step (Show that formula is then true for n+1):

(n + 1)((n + 1) + 1)
2

1 + 2 + 3 + ! + n + (n + 1)

n(n + 1)
n(n + 1) + 2(n + 1)
+ (n + 1) =
2
2

(n + 1)(n + 2)
2

Induction Example 2:
n

k
Prove that
k =1

= 12 + 2 2 + 32 + ! + n 2 =

Basis: If n = 1, then 12
Inductive hypothesis:
Assume formula is true for n

=?

n(n + 1)(2n + 1)
6

1(1+1)(2*1+1) / 6

12 + 22 + 32 + ! + n 2 =

Step (Show that formula is then true for n+1):


?

12 + 22 + 32 + ! + n 2 + (n + 1) 2 =

Yes, TRUE

n(n + 1)(2n + 1)
6

(n + 1)(n + 2)[2 * (n + 1) + 1]
6

n(n + 1)(2n + 1)
n(n + 1)(2n + 1) + 6(n + 1) 2
+ (n + 1) 2 =
6
6
n(n + 1)(2n + 1) + 6(n + 1) 2 (n + 1)[n(2n + 1) + 6(n + 1)]

=
6
6
(n + 1)[n(2n + 1) + 6(n + 1)] (n + 1)(2n 2 + 7n + 6) (n + 1)(n + 2)(2n + 3)

=
=
6
6
6

12

You might also like