CSE 331 - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

CSE 331

Description:

... Level view of the course. Problem Statement. Algorithm. Problem ... Output: b1,b2,...,bn. b1= a1. for i =2 ... n. Find 1 j i s.t. ai lies between bj-1 and bj ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 15
Provided by: Atri
Category:
Tags: cse | courses | make

less

Transcript and Presenter's Notes

Title: CSE 331


1
Lecture 28
  • CSE 331
  • Nov 4, 2011

2
HW 7 due today
Q1, Q2 and Q3 in separate piles
I will not take any HW after 115pm
3
Other HW related stuff
HW 6 will be available for pickup from Monday
Solutions to HW 7 at the end of the lecture
HW 8 has been posted (link on the blog)
4
On Algorithms, Practicality and Proofs
Indeed most of you will not write proofs in your
jobs
5
A request and a warning
Please ask questions if something is not clear
The pace of the lectures is going to pick up
6
High Level view of the course
Problem Statement
Problem Definition
Three general techniques
Done with greedy
Algorithm
Implementation
Data Structures
Analysis
CorrectnessRuntime Analysis
7
Sorting
Given n numbers order them from smallest to
largest
Works for any set of elements on which there is a
total order
8
Divide and Conquer
Divide up the problem into at least two
sub-problems
Recursively solve the sub-problems
Patch up the solutions to the sub-problems for
the final solution
9
Mergesort Algorithm
Divide up the numbers in the middle
Unless n2
Sort each half recursively
Merge the two sorted halves into one sorted output
10
HW 7 due today
Q1, Q2 and Q3 in separate piles
I will not take any HW after 115pm
11
How fast can sorted arrays be merged?
Group talk time
12
Mergesort algorithm
Input a1, a2, , an
Output Numbers in sorted order
If n 1 return the order a1
13
An example run
If n 1 return the order a1
14
Correctness
Input a1, a2, , an
Output Numbers in sorted order
By induction on n
If n 1 return the order a1
Inductive step follows from correctness of MERGE
Write a Comment
User Comments (0)
About PowerShow.com