1. (a). cfw_ a, e, h, k
(b). cfw_a, e
(c). cfw_a, c, e, h, i, k, m
(d). cfw_a, b, c, d, e ,h, i, k, l,m
(f). A cfw_b, d, h, k,l = cfw_a,c,e
2. False. Example A = cfw_1,2, B = cfw_1, and C =cfw_2. A (BC) = cfw_1,2 0 = cfw_1,2, while (A-B)(A-C)
1. Describe an algorithm for finding the smallest integer in a finite
sequence of integers
a. You are given as input a finite set of integers. Let's say that the
set is of size N and that the elements are stored in an array A of
size N. In other words, if
2. Converse: if I will go swimming, then it is sunny
Contrapositive: if I will not go swimming, then it is not sunny.
3. Truth Tables:
a. (p V q) V r
1. Each locker in an airport is labeled with an uppercase letter followed by three digits. How
many different labels for lockers are there?
26 x 10 x 10 x 10 = 26000 different labels. (Product rule)
2. There are 805 lockers in the athletic center and 4026
COSC 3304 Exercises on Substring Search (Total Points = 60)
References: Section 5.3 in Algorithms, 4th edition
1. Give the Knuth-Morris-Pratt DFA for the pattern A A A B A
three-letter alphabet by filling in the table below. (20 Points)
N A A A B A N
Programming Assignment 4
WordNet (http:/wordnet.princeton.edu/ ) is a semantic lexicon for the English
language that computational linguists and cognitive scientists use extensively. For
example, WordNet was a key component in IBM's Jeopardy-pla
COSC 3304: Exercises on Maxflow Total Points = 130.
Reference: pp. 886902 in Algorithms, 4th edition.
Enthusiastic celebration of a sunny day at a prominent northeastern university has resulted in the arrival
at the university's medial clinic of 169 stude
Classes and Instances
George A. Miller Princeton University
Florentina Hristea University of Bucharest
WordNet, a lexical database for English that is extensively used by computational linguists, has
not previously distinguished hyponyms th
sCOSC 3304 Exercises on MST (Total Points = 60)
Reference: Chapter 4.3 in Algorithms, 4th edition.
1. Consider the following weighted undirected graph.
List the edges in the MST in the order in which they are discovered by Prim's algorithm, starting the
COSC 3304 Exercise on Quicksort (20 Points)
References: Section 2.3 in Algorithms 4/e
1. Suppose that the result of the shuffle in Algorithm 2.5 is P A R T I O N E D H F L. Show the result of the
first call on partition() by giving the contents of the arr
COSC 3304 Exercises on Priority Queues
Reference: Section 2.4 in Algorithms 4/e Total Possible Points = 80.
1. Suppose that an array a is a max-heap that contains the distinct integer keys 1, 2, ., N with N > 7.
The key N must be in a and the key N-1
COSC 3304 Exercises on Binary Search Trees
Reference: Section 3.2 in Algorithms 4/e
1. Draw the sequence of BSTs (include the symbol table keys but suppress the values) that result when
you insert the following keys in that order into an initially empty t
COSC 3304 Exercises on Digraphs (total Points Possible = 60)
Reference: Chapter 4.2 in Algorithms, 4th edition.
1. Give the order in which DFS first visits each vertex in the following digraph. This is called the preorder.
(Iterate through the vertices in
COSC 3304 Exercises on String Sort Total Points = 90 Points
References: Section 5.1 in Algorithms, 4th edition
1. (50 Points) Sort the 16 names below using LSD string sort (Algorithm 5.1) in the book. Show
the result (by listing the 16 full words) of each
public class WordNet cfw_
private final RedBlackBST<String, Integer> rbtree;
COSC 3304 Exercises on Tries (total points = 60)
References: Section 5.2 in Algorithms, 4th edition
1. Draw the R-way trie (in the same style as the diagram bottom right of p. 734) when you insert the
following key-value pairs into an initially empty trie
COSC 3304 Exercises on Shortest Paths (Total Points = 70)
Reference: Chapter 4.4 in Algorithms, 4th edition.
1. Consider the following weighted directed graph.
Give the distance of the shortest path from C to each vertex v (except A and C) and the last ed
public class Outcast cfw_
private WordNet wordnet;
/ Constructor takes a WordNet object
public Outcast(WordNet wordnet) cfw_
this.wordnet = wordnet;
/ Given an array of
COSC 3304 Exercises on Reductions Total Points = 80
1. Prove that the following two problems have the same complexity by giving a linear-time
reductions between the two. (40 points each for parts a and b)
3-SUM: given n integers x1, ., xn, are there three
: Sarita V. Medhekar.
: L 20288420
Course Name : Analysis of Algorithms
Program Title : PARTNER MATCHING
NAME : SARITA V. MEDHEKAR.
LUID : L20288420
COURSE : COSC 5313 ANALYSIS OF ALGORITHMS
PROGRAM : PART