CS 3343 (Fall 2013) Assignment 6 (80 points)
Due: Nov 12 before class starts
1. (15 point) Shortest paths
Use dynamic programming to find the shortest path from node S to node G on the following graph,
with the constraint that one is allowed only to move
CS 3343.001 (Fall 2015) Exam 1 Solution
1. (16 points) For each pair of functions in the table below, determine whether f (n) O(g(n),
f (n) (g(n), f (n) (g(n), or all of them. It is NOT necessary to justify your answer.
f (n)
n + 3n + 4
100 + log n
n + lo
CS 3343: Analysis of
Algorithms
Lecture 14: Order Statistics
Order statistics
The ith order statistic in a set of n elements
is the ith smallest element
The minimum is thus the 1st order statistic
The maximum is the nth order statistic
The median is t
CS 3343: Analysis of
Algorithms
Lecture 13: Linear time sorting
More about sorting
How many sorting algorithms do you
know?
What are their time complexity?
Whats common about them?
Can we do better than (n log n)?
Yes and no
Outline
More about sorti
CS 3343: Analysis of
Algorithms
Lecture 17: Intro to Dynamic
Programming
In the next few lectures
Two important algorithm design techniques
Dynamic programming
Greedy algorithm
Meta algorithms, not actual algorithms (like
divide-and-conquer)
Very use
CS 3343: Analysis of
Algorithms
Lecture 5: Solving recurrence by
recursion-tree method
Problem of the day
How many multiplications do you need to
compute 316?
316 =3 x 3 x 3 . x 3
Answer: 15
316 =38 x 38
38 =34 x 34
34 =32 x 32
32 =3 x 3
Answer: 4
Pseudo
Analysis of Algorithms
CS 477/677
Randomizing Quicksort
Instructor: George Bebis
(Appendix C.2 , Appendix C.3)
(Chapter 5, Chapter 7)
Randomizing Quicksort
Randomly permute the elements of the input
array before sorting
OR . modify the PARTITION procedu
CS 3343: Analysis of
Algorithms
Lecture 10: Heap sort
Heap sort
Another (n log n) sorting algorithm
In practice quick sort wins
The heap data structure and its variants
are very useful for many algorithms
Selection sort
<=
Sorted
<=
<=
Sorted
Find mini
Homework 1 Answers
CS 3343 Spring 2016
Tom Bylander, Instructor
assigned January 11, 2016
due January 27, 2016
Your solutions must be submitted to Blackboard as a PDF document.
1. (20 pts.) Using the pseudocode conventions of the textbook, write an (n) al
CS 3343 (Fall 2013) Assignment 1
Due: Tuesday, Sept 10 before class starts
1. (25 points) Order the following functions according to their order of growth from the lowest to the
highest. If you think that two functions are of the same order (i.e f (n) (g(
CS 3343 (Fall 2013) Assignment 7
Due: Dec 5 (Thur) before class starts
Part II - Questions 6-9, 45 points.
Your name:
Discussed with:
6. (10 points) Print out the confirmation email that you have done the course evaluation.
7. (15 points) Graph representa
CS 3343 (Spring 2013) Assignment 4
Solution
1. (25 points) Quick sort.
a. (10 points) Study the pseudocode of the Partition algorithm in lecture9.ppt. Use Slide #37 as a
model, illustrate the operation of Partition on array A = [14 1 16 11 12 20 4 15 3 19
CS 3343 (Fall 2013) Assignment 2 (80 points)
Due: Sept 17 before class starts
1. (20 points) Find the order of growth of the following sums (i.e., is it in (n2 ), (nlgn), or . . . ?) If the
analysis involves multiple steps, write down each intermediate st
Homework 4 Answers
CS 3343 Spring 2016
Tom Bylander, Instructor
assigned March 7, 2016
due March 25, 2016
Your solutions must be submitted to Blackboard as a PDF document.
1. (10 pts.) Use a recursion tree to determine good asymptotic bounds on the recurr
Homework 3 Answers
CS 3343 Spring 2016
Tom Bylander, Instructor
assigned February 22, 2016
due March 4, 2016
Your solutions must be submitted to Blackboard as a PDF document.
1. (10 pts.) Use a recursion tree to determine a good asymptotic upper bound on
Homework 5 Answers
CS 3343 Spring 2016
Tom Bylander, Instructor
assigned April 6, 2016
due April 15, 2016
Your solutions must be submitted to Blackboard as a PDF document.
1. (10 pts.) Show a recursion tree for T (n) = T (n 1) + T (n 2) + 1. Provide upper
CS 3343 (Fall 2013) Assignment 7
Solution
1. Fractional knapsack problem.
Weight (LB)
10
50
40
20
40
10
x
Item ID
A
B
C
D
E
F
Total
Value ($)
40
30
80
60
10
60
x
Value / Weight ($/LB)
4.0
0.6
2.0
3.0
.25
6.0
x
2. Graph representations.
a. adj[1]
adj[2]
ad
CS 3343: Analysis of
Algorithms
Lecture 9: Review for midterm 1
Analysis of quick sort
10/19/15
1
Exam (midterm 1)
Closed book exam
One cheat sheet allowed (limit to a single
page of letter-size paper, double-sided)
Tuesday, Feb 24, 10:00 11:25pm
Basi