CAS CS 112 Spring 2012 Programming
Assignment 4
Due at 10:00 pm on Thursday, March 29
1
Visualizing Binary Trees [79 pts]
In this assignment, we will augment the binary tree classes presented in the textbook with
routines to create large binary trees by r
Fall 2015
CS330 Algorithms
Homework 1
Homework 1, due Sept 16
You must prove your answer to every question by a convincing explanation
(in complete sentences). Just writing a formula or yes/no is not sufficient.
I encourage you to type up your problem set
CAS CS 112 Spring 2012, Assignment 5
Due at 10:00 pm on Thursday, April 12
Anagram Solver
In this assignment you will implement a program which prints out all anagrams of a specied
string. Two strings are anagrams of one another if by rearranging letters
CS 330 Spring 2013, Assignment 1
Problems due at the beginning of class on Thursday January 31.
Our rst homework has several questions that require short proofs. In writing up proofs, try to make sure your
reasoning ows logically from one statement to ano
Fall 2015
CS330 Algorithms
Midterm exam
Midterm exam
Only a single hand-written crib sheet can be used, no books or notes.
You must prove your answer to every question. Please, write legibly and
neatly!
Wild guessing is not recommended. You will get some
CAS CS 112 Spring 2012, Programming Assignment 6
Due at 10:00 pm on Thursday, May 3
In this assignment you have to investigate the structure of a real world graph using some
of the techniques that we discussed in class. The graph that you will use is a co
CS 330 Spring 2013, Midterm Study Questions
Exam will be closed book
Question 1. Suppose you have a set of N gold coins of which all but one have identical weight. The exception is
a single fake coin that weighs less than real coins. To detect the fake, y
Interval Scheduling: Greedy Algorithms
and
Dynamic Programming
d
e
f
b
c
g
h
a
0
1
2
3
4
5
6
7
8
9
10
Slides based on Kevin Wayne / Pearson-Addison Wesley
11
Time
Overview of Interval Scheduling
The Basic Interval Scheduling Problem
Schedule as many non-o
CS 330: Notes on Asymptotic Notation
by Leo Reyzin
Computer scientists usually measure resources consumed by algorithms as a function of input size.
(Typically we measure time, but we may be interested in other resources, such as memory, power,
network ba
4.8 Huffman Codes
These lecture slides are supplied by Mathijs de Weerd
Data Compression
Q. Given a text that uses 32 symbols (26 different letters, space, and
some punctuation characters), how can we encode this text in bits?
Q. Some symbols (e, t, a, o,
CMPSCI 311: Introduction to Algorithms
First Midterm Exam: Practice Exam
Name:
ID:
Instructions:
Answer the questions directly on the exam pages.
Show all your work for each question. Providing more detail including comments and explanations can help wi
CS330 Assignment 1
Zhengyuan Jin (U15972934)
September 14, 2017
Problem 1. (Chapter 1 Practise 8)
Assume we have equal numbers of Men and Women with number of 3. Men all give
their actual preferences of women with the table below:
m0 w1 w2 w0
m1 w2 w0 w1
cs sacTiromem QJcf - ,7
Wanna nned O
b\cm 1.0hcAchcx A,pm\o\em8
(how-3099! MQMWWJ)
We (1th 06 m and m on a woman ws
Hm mmuml WK mgorhhm wi-Hn Mac
be +( (cw; ow A um and up
.0 \och m and mi.
Pm
\M 0(- (0
tmse gamma- 1
wuh a NOM m
s s 1
WU" t' 4 uoz. 35 (
CS 330 Spring 2017 Lab 4
Question 1. Dijkstra Algorithm
Given the Graph G, find the shortest path from s to t.
Question 2.
Given currency denominations: 1, 5, 10, 25 and 100
(a) Specify a greedy algorithm for giving change which minimizes the number of co
CS 330 Spring 2017 Lab 6 (Midterm Review)
Question 1.
A
5
3
1
F
5
B
C
1
2
1
4
D
5
E
Consider this graph:
(a) Show the result of running Dijkstras algorithm on the above graph starting at node A.
(b) Show the sequence of edges that are added to the M ST wh
CS 330 Spring 2017 Lab 4 Solution
Question 1. Dijkstra Algorithm
Given the Graph G, find the shortest path from s to t.
Boston University
1
Prof. John Byers and Prof. Dora Erdos
Question 2.
Given currency denominations: 1, 5, 10, 25 and 100
(a) Specify a
CS 330 Spring 2017 Lab 5
Question 0. Do before lab
A
4
C
2
1
S
3
1
T
3
3
4
2
B
D
Find the shortest path from S to T by running Dijkstras Algorithm on the above graph.
Find a minimum spanning tree by running Prims Algorithm on the above graph (initialize
EC330 What is an algorithm?
Prof. Ari Trachtenberg
EC330, Spring 2017
Selection Sort(A[1.n]):
for i=1 to n
for j =i+1 to n
if A[i]>A[j] then
swap A[i] and A[j]
loop invariant
Lemma: After iteration j of the inner loop
A[i] is the smallest element of A[i.j
CMPSCI 311: Introduction to Algorithms
First Midterm Exam: Practice Exam
Name:
ID:
Instructions:
Answer the questions directly on the exam pages.
Show all your work for each question. Providing more detail including comments and explanations can help wi
Fall 2015
CS330 Algorithms
Homework 1
Homework 1, due Sept 30
You must prove your answer to every question by a convincing explanation
(in complete sentences). Just writing a formula or yes/no is not sufficient.
Problem 1 (20pts) Suppose that you are a tr
Fall 2015
CS330 Algorithms
Homework 2
Homework 2, due Sept 23
You must prove your answer to every question by a convincing explanation (in
complete sentences). Just writing a formula or yes/no is not sufficient.
In the problem below, you will be writing P
Interval Scheduling
B
C
A
E
D
F
G
H
0
1
2
3
4
5
6
7
8
9
10
11
0
1
2
3
4
5
6
7
8
9
10
11
Time
Interval Scheduling
B
C
A
E
D
F
G
H
0
1
2
3
4
5
6
7
8
9
10
11
3
4
5
6
7
8
9
10
11
B
0
1
2
Time
Interval Scheduling
B
C
A
E
D
F
G
H
0
1
2
3
B
0
1
2
4
5
6
7
8
9
10
4.8
Huffman Codes
These lecture slides are supplied by Mathijs de Weerd
Data Compression
Q. Given a text that uses 32 symbols (26 different letters,
space, and some punctuation characters), how can we encode
this text in bits?
Q. Some symbols (e, t, a, o,
CS 330 Spring 2016 Lab 5
Question 1 Let A be an unsorted array of n integers. Assume that all of the n integers are distinct.
(a) Give a (very simple) algorithm to nd the absolute minimum (i.e. the smallest element) in A. Explain
why the absolute minimum
Algorithms
Pter Gcs
Freely using the textbooks by
Kleinberg-Tardos and Cormen-Leiserson-Rivest-Stein,
and the slides of Kevin Wayne
Computer Science Department
Boston University
Fall 2015
It is best not to print these slides, but rather to download them
f
Fall 2015
CS330 Algorithms
Homework 9
Homework 9, due Nov 18
You must prove your answer to every question by a convincing explanation
(in complete sentences). Just writing a formula or yes/no is not sucient.
Problem 1 A human-resources manager called Imel
2n
d
Ed
iti
on
Algorithms
in a Nutshell
A PRACTICAL GUIDE
George T. Heineman,
Gary Pollice & Stanley Selkow
ALGORITHMS
IN A NUTSHELL
Second Edition
George T. Heineman,
Gary Pollice
& Stanley Selkow
Algorithms in a Nutshell
by George T. Heineman, Gary Poll
CS330: Homework #3
Due on October 12, 2017 at 3:10pm
Professor Dora Erdos Section A1
1
CS330 (Professor Dora Erdos Section A1): Homework #3
Problem 1
Problem 1
Chapter 4, Exercise 19, on p. 198
Solution: Essentially were looking for a Spanning Tree with t
CS330: Homework #2
Due on September 28, 2017 at 3:10pm
Professor Dora Erdos Section A1
1
CS330 (Professor Dora Erdos Section A1): Homework #2
Problem 1
Problem 1
Develop an efficient algorithm to find the length of the longest path in a directed graph G =
CMPSCI 311: Introduction to Algorithms
First Midterm Exam
October 13, 2016.
Name:
ID:
Instructions:
Answer the questions directly on the exam pages.
Show all your work for each question. Providing more detail including comments and explanations can help