Intro to Computer Algorithms Lecture 1 - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Intro to Computer Algorithms Lecture 1

Description:

Euclid's Algorithm. The challenge. Greatest-common divisors. GCD(12,6) = 6. GCD(17,16) = 1 ... Euclid's Algorithm. Correctness? Halts? Prime-Factor approach ... – PowerPoint PPT presentation

Number of Views:63
Avg rating:3.0/5.0
Slides: 17
Provided by: pgb8
Category:

less

Transcript and Presenter's Notes

Title: Intro to Computer Algorithms Lecture 1


1
Intro to Computer Algorithms Lecture 1
  • Phillip G. Bradford
  • Computer Science
  • University of Alabama

2
Announcements
  • ACM initial meeting of the year.
  • Thursday, August 28th, 500pm
  • in East Eng. 119
  • Industrial Colloquium Series
  • Tuesday, September 2nd, 500pm in EE 119
  • Herschel Chandler presents
  • Being an Independent Computer Consultant

3
General Lecture Format
  • Some power-point slides
  • Some white-board writing
  • Details are very important
  • Lots of Interaction a good thing

4
Lecture Outline
  • Syllabus
  • Learning
  • Grading
  • Your Expectations
  • My Expectations
  • Material High Level Overview
  • Motivation
  • Foundations, History and Perspective
  • Applications of Algorithms the Future

5
Lecture Outline
  • The book by A. Levitin
  • Design paradigms approach
  • Nice way to think about design analysis
  • Classifications of challenges on how they are
    solved
  • Commonalities are the solutions
  • Lets get started
  • Chapter 1.1 to 1.3

6
My Expectations
  • Exercise gives strength
  • This is an exercise course
  • Excellent Students give excellent results
  • Given some work
  • What are your expectations?
  • Survey

7
Motivation
  • How hard is it to solve Computer Challenges?
  • Deep Questionheavy ramifications
  • Optimization Applications
  • Networks
  • Financial Models, business issues, etc.
  • Real-Time Applications
  • Airplanes, trains, missiles
  • Sensors, medical applications, etc.

8
Motivation
  • Foundational questions
  • Sorting searching
  • Exhaustive Search
  • Apparent hardness of old and new challenges
  • Cuts across engineering and other math science
    disciplines

9
Algorithms
  • What is an algorithm?
  • Unambiguous list of instructions that solve a
    challenge
  • Gives the right answer on legitimate input
  • What about algorithms that use randomness?
  • Designed with randomness in mind
  • Really, pseudo-random numbers

10
Algorithms what to doPage 10, Figure 1.2
  • Understand the challenge!
  • Design an algorithm
  • Easy sub cases first, perhaps
  • Prove correctness
  • Analyze the algorithm
  • Check improve design if analysis warrants
  • Iterate, iterate,

11
Euclids Algorithm
  • The challenge
  • Greatest-common divisors
  • GCD(12,6) 6
  • GCD(17,16) 1
  • GCD(20,15) 5
  • Euclids method
  • GCD(m,0) m
  • GCD(m,n) GCD(n, m mod n)

12
Euclids Algorithm, cont.
  • Book example
  • GCD(60,24) GCD(24,12) GCD(12,0) 12
  • Euclid(m,n)
  • While(n ! 0)
  • r ? m mod n
  • m ? n
  • n ? r
  • Return m

13
Euclids Algorithm
  • Correctness?
  • Halts?
  • Prime-Factor approach
  • How?
  • Which is better??
  • Relative costs?

14
Sieve of Eratosthenes
  • Challenge given an integer n, find all primes lt
    n.
  • Example n 18, then output 2,3,5,7,11,13,17
  • Elimination of prime candidates by potential
    factors
  • Claim the largest potential factor
    floor(sqroot(n))

15
Types of Problems
  • Sorting, Searching
  • Stable Sorts
  • String Processing
  • Graph problems
  • Combinatorial problems
  • TSP
  • Geometric Problems
  • Numerical Problems

16
Homework set
  • Due Tuesday
  • Page 8, 5, 6
  • Page 17, 1
  • Page 18, 3, 8
Write a Comment
User Comments (0)
About PowerShow.com