1. A palindrome is a string that reads the same forwards and backwards. Suppose we are
given a string S = s.szsssn. and we want to ﬁnd the longest palindrome that can be
formed by deleting zero or more characters from the string.
2 When their respective s
CSCE 411
Design and Analysis
of Algorithms
Set 10: Lower Bounds
Prof. Jennifer Welch
Fall 2016
CSCE 411, Fall 2016: Set 10
1
What is a Lower Bound?
Provides information about the best possible
efficiency of ANY algorithm for a problem
Tells us whether we
CSCE 411: Design and Analysis of Algorithms
Expected Running Time of Randomized Quicksort
Fall 2016
Reference: Our textbook (Cormen, Leiserson, Rivest and Stein, Introduction to Algorithms, 3rd Ed.)
The running time of quicksort is proportional to the num
CSCE 411-200, Fall 2016
Homework 4 Solutions
Problem 1: Exercise 17.4-3 (p. 471): Suppose that instead of contracting a table by halving its size when
its load factor drops below 1/4, we contract it by multiplying its size by 2/3 when its load factor drop
CSCE 411: Design and Analysis of Algorithms
Optimality of Huffmans Algorithm
October 19, 2016
This proof is a little different than the one in the textbook (pp. 433435) and is drawn from Algorithms
from P to NP, Vol. 1, Moret and Shapiro, Benjamin/Cumming
(1 pt) Briefly explain the main idea of the aggregate method of amortized analysis?
Brute Force Analysis
(1 pt) Briefly explain the main idea of the accounting method of amortized analysis?
assign costs to each operation so that it is easy to sum them up
CPSC 211 Data Structures & Implementations
(c) Texas A&M University [ 221]
Trees
Important terminology:
root
edge
node
parent
child
leaf
Some uses of trees:
model arithmetic expressions and other expressions
to be parsed
model game-theory approaches to so
CSCE 411-200, Fall 2016
Homework 2 Solutions
Problem 1: Here is an attempt at a decrease-and-conquer algorithm to determine if an undirected graph G
with n vertices is connected. Assume G is represented using an n-by-n adjacency matrix A, with columns
ind
CSCE 411-200, Fall 2016
Homework 6 Solutions
Problem 1: Draw the decision tree for bubble-sort with n = 3. Use the code for bubble-sort on page 40 of
the textbook.
Bubblesort(A) / A.length = n
for i = 1 to n - 1
for j = n downto i + 1
if A[j] < A[j-1]
exc
CSCE 411-200, Fall 2016
Homework 1 Solutions
Problem 1: Suppose you are given an n n boolean matrix, which is the adjacency matrix representation
of an undirected graph with n vertices. Design a brute force / exhaustive search algorithm that determines
wh
CSCE 411-200, Fall 2016
Homework 3 Solutions
Problem 1: Transform the following word problem into a linear program. Farmer Fred has 10 acres of land,
on which he can grow cotton and soybean. For tax purposes, he needs to farm at least 7 acres. He has $120
CSCE 629: Design and Analysis of Algorithms
Amortized Analysis of Dynamic Table
Spring 2017
(Based on Introduction to Algorithms, 2nd and 3rd Eds., by Cormen, Leiserson, Rivest and Stein.)
1
Problem Definition
Here is a more extensive example of amortized
CSCE 411-200, Fall 2016
Homework 5 Solutions
Problem 1: Exercise 24.3-8 (p. 664): Let G = (V, E) be a weighted, directed graph with nonnegative
weight function w : E cfw_0, 1, . . . , W for some nonegative integer W . Modify Dijkstras algorithm to
comput
CSCE 411
Design and Analysis
of Algorithms
Set 12: Undecidability
Prof. Jennifer Welch
Fall 2016
CSCE 411, Fall 2016: Set 12
1
Sources
Theory of Computing, A Gentle
Introduction, by E. Kinber and C.
Smith, Prentice-Hall, 2001
Automata Theory, Languages an
CSCE 411: Design and Analysis of Algorithms
Notes on Max Flow
Fall 2016
(Based on the presentation in Chapter 26 of Introduction to Algorithms, 3rd Ed. by Cormen,
Leiserson, Rivest and Stein.)
1
Motivation and Basic Definitions
Consider applications that
CSCE 411: Design and Analysis of Algorithms
Exam 1
October 15, 2014
Name:
Instructions:
1. This is a closed book exam. Do not use any notes or books, other than your own 8.5-by-11
inch review sheet (double-sided is OK). Do not confer with any other person
CSCE 411
Design and Analysis
of Algorithms
Set 11: NP-Completeness
Prof. Jennifer Welch
Fall 2016
CSCE 411, Fall 2016: Set 11
1
Polynomial Time Algorithms
Most of the algorithms we have seen
so far run in time that is upper
bounded by a polynomial in the
.
.
Set 7: Induction and
Recursion
CSCE 222-200: Discrete Structures for Computing,
Honors
Jennifer L. Welch
Department of Computer Science & Engineering
Texas A&M University
Spring 2015
Spring 2015
CSCE 222-200: Set 7: Induction and Recursion
1/
101
1/10
CSCE 411
Design and Analysis
of Algorithms
Set 9: Randomized Algorithms
Prof. Jennifer Welch
Fall 2016
CSCE 411, Fall 2016: Set 9
1
Quick Review of Probability
Refer to Chapter 5 and Appendix C of the textbook
sample space
event
probability distribution
i
In order to count the number of paths of some fixed length k in a graph between all
pairs of vertices, we can use the transform and conquer paradigm. What problem do
we transform to?
Sol: Adjacency matrix A to the kth power gives number of paths of length
CSCE 411
Design and Analysis of Algorithms
Andreas Klappenecker
Motivation
In 2004, a mysterious billboard showed up
- in the Silicon Valley, CA
- in Cambridge, MA
- in Seattle, WA
- in Austin, TX
and perhaps a few other places.
Remarkably, the puzzle on
Divide and Conquer
Andreas Klappenecker
The Divide and Conquer Paradigm
The divide and conquer paradigm is important general technique
for designing algorithms. In general, it follows the steps:
- divide the problem into subproblems
- recursively solve t
The Fast Fourier Transform
Andreas Klappenecker
!
Motivation
There are few algorithms that had more impact on modern society
than the fast Fourier transform and its relatives.
The applications of the fast Fourier transform touch nearly every
area of scie
Greedy Algorithms
and Matroids
Andreas Klappenecker
Greedy Algorithms
A greedy algorithm solves an optimization problem by working in
several phases.
In each phase, a decision is made that is locally optimal given the
information that has been obtained s
Dynamic Programming:
The Matrix Chain Algorithm
Andreas Klappenecker
!
[partially based on slides by Prof. Welch]
Matrix Chain Problem
Suppose that we want to multiply a sequence of rectangular
matrices. In which order should we multiply?
A x (BxC)
or
(A