Announcement: AWC 400 Level Lecture Series
The AWC will be running its 400 level lecture series (400 LLS) on October 17,18 and 19 (5-6pm) in CSIC 3117. FREE FOOD. Professors who will be teaching the 400 level courses in the spring will each spend 15 minut
Exam #1 is Thursday 6-7:30pm
You should review material going back to the first week. For example:
Rules for logs, calculus, sums, expected values, Constructive induction, the Fibonacci examples and proofs Algorithms that youve seen and now analyzed in mo
What does it mean for a value to be randomly selected? How can we make use of randomness? Monte Carlo Algorithms
Dont always give the correct answer. The runtime can be described consistently.
Las Vegas Algorithms
They always give the correct answers. T
This is another example of a divide and
Step 1 (divide)
Select a pivot value and logically
partition the list into two sub-lists:
L1: values less than the pivot
L2: values greater than the pivot
Your list is now: L1,pivot,L2
Step 2 (con
Recall that regardless of the average case, that if we expect mostly-sorted inputs, then the runtime with be bad. Can we address the issue of a sorted list leading to n2 runtime with the partitioning algorithm we are using?
Simply stated: Given a list of n unique values, find the ith smallest. Common Examples 1st smallest (Minimum) nth smallest (Maximum) n/2th smallest (Median)
How can we approach solving such problems?
Trivial Way: Sort the list and then return the ith posi
Initialize the matrix c to all zeros. Assume we have an array r of request records. for d=1 to n+1 for i=0 to n-d+1 j=i+d if (r[i].f<=r[j].s) for k=i+1 to j-1 if ( (r[i].f<=r[k].s) & (r[k].f<=r[j].s) ) & (c[i,k]+1+c[k,j]>c[i,j]) ) then c[i,j]= c[i,k]+1+c[
Initialize the matrix c to all zeros. Assume we have an array r of request records. for d=1 to n+1 for i=0 to n-d+1 j=i+d if (r[i].f<=r[j].s) for k=i+1 to j-1 if ( (r[i].f<=r[k].s) & (r[k].f<=r[j].s) & (c[i,k]+1+c[k,j]>c[i,j]) ) then c[i,j]= c[i,k]+1+c[k,
CMSC 351:Spring 2011
CMSC351 Test 1 Reference
(g (n) = cfw_f (n): there exist positive constants c1 , c2 , and n0 such that 0 c1 g (n) f (n) c2 g (n) for
all n n0 .
O(g (n) = cfw_f (n): there exist positive constants c
CMSC 351: Practice Questions for Midterm Exam
These are practice problems for the upcoming midterm exam. You will be given a sheet
of notes for the exam. Also, go over your homework assignments. Warning: This does not
Lower BOWNL sz' Cowm'ron-galm/ffy
@what i: m PM bounac
76'! Compm'son- $452.4 .ror'nj?
no In: =
wick 30V 1" 0(0 2') in we VJ'é- can: a
r'nserlvbn saw-F 0(a) :n A256 case.
Mug We aébjro In Harte 6*
upper Loud. I" hlojn
SO WW I" an. [OW éourwf
HC to HP Reduction bool HamCycle(graph G) cfw_ for each edge cfw_u,v in G cfw_ copy G to a new graph G delete edge cfw_u,v from G add new vertices x and y to G add new edges cfw_x,u and cfw_y,v to G if (HamPath(G) return true retur
Here is how you might do this. Given an undirected graph G, create a directed graph G by just replacing each undirected edge cfw_u, v with two directed edges, (u, v ) and (v, u). Now, every simple path in the G is a simple path in