Algorithm Analysis (CSC 301 2015F) : EBoards

CSC301.01 2015F, Class 16: Sorting


Overview

Preliminaries

Admin

Upcoming Work

Extra Credit

Academic

Peer

Exam 1

Questions

Comparing sorting algorithms

What kinds of things might you ask about the data set?

What kinds of things might you ask about the sorting algorithm? (What requirements you might have on the sorting algorithm?)

General algorithm strategy:

O(nlogn) sorting algorithms

Lower bounds on sorting algorithms

Theorem: For algorithms based only on comparing values in an array, sorting is Omega(nlogn)

Detour: Sorting tree. Provide a visualization of how a sorting routine determines how to permute the array to sort it.

Any comparison-based sorting routine can be described by a sorting tree.

The best comparison-based sorting routine will require the height of the shortest sorting tree.

How many leaves are there in a sorting tree for an array of N values (what's the minimum number of such leaves)? N!, the number of permutations of N values.

Depth of tree is O(log(N!)) is approximately O(NlogN)

Lemma: 2^(N!) is in Theta(2^(NlogN))

Proof by induction