Intro to Computer Algorithms Lecture 15 - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Intro to Computer Algorithms Lecture 15

Description:

Beth Green, Wal-Mart ISD Recruiting. Who & What is Wal-Mart hiring? ... Classic Transform and conquer. Transformation uses row operations. Exchange two rows ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 14
Provided by: pgb8
Category:

less

Transcript and Presenter's Notes

Title: Intro to Computer Algorithms Lecture 15


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

2
Announcements
  • Advisory Boards Industrial Talk Series
  • http//www.cs.ua.edu/9IndustrialSeries.shtm
  • Departmental Colloquium
  • 27-Oct, in 110 East Engineering
  • Featuring Dr. Gary McGraw
  • Building Secure SoftwareWhy the standard
    approach to security doesn't work

3
CS Story Time
  • Prof. Jones research group
  • See http//cs.ua.edu/StoryHourSlide.pdf

4



Association of Computing Machinery
The First Society in Computing
Meeting Information Session Tuesday, October
21 Time and Place EE 119 at 500
p.m.
Join us on Tuesday for FREE FOOD and good
information Guest Speaker Beth Green,
Wal-Mart ISD Recruiting Who What is Wal-Mart
hiring?
For more info, visit www.studentacm.org
5
Outline
  • Transform and conquer
  • Technique
  • Examples

6
Transform and Conquer
  • Start with a problem instance PI
  • Change or transform PI into SI
  • Simpler Instance
  • So that solving SI solves PI
  • Solve the simpler SI

7
Transformation in more detail
  • Instance Simplification
  • Make simpler or more convenient
  • Representation Change
  • Different representation of the same problem
  • Problem Reduction
  • Instance of a problem that has already been
    solved

8
Classic ExamplesElement Uniqueness
  • Presorting
  • Once a list is sorted, then it is easy to get
    some forms of information from it
  • Element Uniqueness
  • Determine if any two elements in a list are the
    same
  • How?
  • Sort and then check neighbors
  • Cost?
  • O(n log n) counting the sort!

9
Classic ExamplesMode
  • Computing the Mode of a list of elements
  • What is the mode?
  • Most common occurring element
  • How?
  • Brute force method
  • For each element count how often it occurs
  • Track the largest occurring element so far

10
Classic ExamplesMode
  • The O(n2) solution
  • mode_freq ? 0
  • mode_value ? 0
  • run_value ? 0
  • run_length ? 0
  • The algorithm at the board

11
Classic ExamplesMode
  • A better solution using transform and conquer
  • Sort first!
  • Transforming the challenge into a simpler one
  • Algorithm on Page 196
  • Cost?

12
Classic ExamplesSearching vs. Sorting
  • Given the cost of comparison based sorting is O(n
    log n)
  • The cost of searching a sorted list is O(log n)
  • How many searches through a length n list do we
    have to do to justify a sort?

13
Gaussian Elimination
  • Classic Transform and conquer
  • Transformation uses row operations
  • Exchange two rows
  • Replace an equation with an non-zero multiple
  • Replace an equation with the sum or difference of
    itself and another equation
  • Examples at the board
Write a Comment
User Comments (0)
About PowerShow.com