Probability & Expectation
Lecture 3- supplement
1
About this lecture
What is Probability?
What is an Event?
What is a Random Variable?
What is Expectation or Average Value
of a Random Variable?
Useful Thm: Linearity of Expectation
2
Experiment and Sampl
CSC 7300
Algorithms Design and
Analysis
Heaps
1
Heaps
Given a set S of data with ordered
keys
Support two main operations
Insert
Extract-min
Decrease-key
2
Binary Heap
A binary heap is a binary tree that
satisfies both:
(1) Shape Property
All levels
CSC 7300
Dynamic Programming
1
Dynamic Programming
Greedy algorithms, work on sequential
choice and recursively solve smaller
problems
For some problems, this sequential choice
may not directly work. The strategy has to
be generalized, to work with qual
CSC 7300
NP-Completeness
1
About this Lecture
What is NP ?
How to check if a problem is in NP ?
The problem is alternatively referred as
Language, and each problem instance as a
particular string belonging to the language
Cook-Levin Theorem
Showing o
Single-Source Shortest Path
Let G = (V,E) be a weighted graph
the edges in G have weights
can be directed/undirected
can be connected/disconnected
Let s be a special vertex, called source
Target: For each vertex v, compute the
length of shortest path
CSC 7300
Greedy Algorithms
1
About this lecture
Introduce Greedy Algorithm
Look at some problems solvable by
Greedy Algorithm
2
Coin Changing
Suppose that in a certain country, the
coin dominations consist of:
$1, $2, $5, $10
You want to design an alg
CSC7300
Algorithms Design and
Analysis
Lecture 3: Lower Bounds, Sorting
in Linear Time, Order Statistics
1
Lower Bounds
Lower bound of any comparison
sorting algorithm
applies to insertion sort, selection
sort, merge sort, heapsort, quicksort,
does not
CSC 7300 : Lecture 7
Hashing, Pattern Matching
Hashing Problem
Let U = cfw_ 1, 2, , u be a universe
S = n distinct keys chosen from
U
The Hashing Problem :
To store S such that the following
operations can be done efficiently :
Search(x, S) : Is x in S ?
CSC 7300
Algorithm Design and Anal
ysis
Lecture 2
1
This lecture .
Growth functions
Recurrences
Quicksort
2
Merge Sort
(Recap)
The following is a C-style pseudo-code for Merge So
rt.
The subroutine MERGE(A,p,q,r) is missing.
This can be done by creatin
CSC 7300
Algorithms Design and Analysis
Week 1
Overview + Growth functions
1
Overview
General Information
Scope
Textbook
Assessment
2
General Information
Web page:
http:/csc.lsu.edu/~rahul/7300
Instructor: Rahul Shah <[email protected]>
Office hours
W
CSC 7300
Algorithms Design and An
alysis
Lecture 4: Divide and Conquer,
Amortization, Binary Search Trees
1
Divide and Conquer
Review: Median / Selection
Inversion Pairs
Closest Pair
Polynomial Multiplication
2
Inversion Pairs
Given a sequence of n disti
CSC 7300
HW 1
Due Oct 5 by end of day
1.
Give an in-place QuickSort algorithm. Your algorithm should return the
sorted array in the memory space of the input array and use only O(1) extra
memory space. You may assume that making recursive calls does not u