# Register now to access 7 million high quality study materials (What's Course Hero?) Course Hero is the premier provider of high quality online educational resources. With millions of study documents, online tutors, digital flashcards and free courseware, Course Hero is helping students learn more efficiently and effectively. Whether you're interested in exploring new subjects or mastering key topics for your next exam, Course Hero has the tools you need to achieve your goals.

24 Pages

### ex5

Course: CSCI 6212, Fall 2010
School: GWU
Rating:

#### Document Preview

6212 CS FALL 11 EXERCISE 5 OCT 12 (WED) Your Name (First, Last Name): Email: 1. (Making Change) Consider the denominations [1, 5, 7]. (a) Give an example of C &lt; 30 for which the greedy algorithm returns an incorrect answer. Write down what the greedy algorithm returns and what the correct is. (b) answer Write down the recurrence relation for opt[i], relating opt[i] to opt[i-1], etc. (c) Fill in the...

Register Now

#### Unformatted Document Excerpt

Coursehero >> District of Columbia >> GWU >> CSCI 6212

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
6212 CS FALL 11 EXERCISE 5 OCT 12 (WED) Your Name (First, Last Name): Email: 1. (Making Change) Consider the denominations [1, 5, 7]. (a) Give an example of C < 30 for which the greedy algorithm returns an incorrect answer. Write down what the greedy algorithm returns and what the correct is. (b) answer Write down the recurrence relation for opt[i], relating opt[i] to opt[i-1], etc. (c) Fill in the table below showing the values of opt. i opt 1 1 2 2 3 4 5 6 7 8 9 10 11 12 13 (d) Check that your value for opt[10] in (c) satises the relation given in (b). 14 15
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

GWU - CSCI - 6212
CS 6212 FALL 11 EXERCISE 6OCT 19 (WED)Your Name (First, Last Name):Email:1. (Running Times) Write down the number of times the following Python programs print hello (as afunction of the input n) using the O() notation.def hello3(n):if n &lt;= 0: retur
GWU - CSCI - 6212
CS 6212 FALL 11 EXERCISE 7OCT 26 (WED)Your Name (First, Last Name):Email:1. (Bellman-Ford Algorithm)Show the computation of the Bellman-Ford algorithm on input the following graph with destinationnode t.a352d.b13t21eopt01234t00
GWU - CSCI - 6212
CS 6212 FALL 11 EXERCISE 8NOV 9 (WED)Your Name (First, Last Name):Email:1. Maximum FlowWrite down a maximum ow for the graph below (write down the ow value at every edge). Inaddition, write down the corresponding ow value.a2.s1b2d1131c
GWU - CSCI - 6212
CS 6212 FALL 11 EXERCISE 9Your Name (First, Last Name):NOV 16 (WED)Email:1. KT Chapter 7, Execerise 20(a)Dene a ow network with the following vertices:source s, a node xi representing each balloon i, a node zj representing each condition cjand a si
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 1Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.Algorithmic ideas are pervasiveapplications.Economics, auctions and game theoryBiology, genes and genomesCombinatorial optimizationInternet search and massive d
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 2Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.Stable matching probleminput. given n men and n women,each man ranks the women from best to worst.each woman ranks the men from best to worst.goal. nd a stable m
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 3Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.AnnouncementsHomeworkHomework 1 is out and due Sep 16 (Fri), 11.59 PMHomework 0 deadline is overstart early, form study groups; individual work, no copyingGener
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 4Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.Graph traversal and connectivitygraph traversalto visit the vertices in some systematic order.s-t connectivity problem.given two nodes s and t, is there a path b
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 5Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.First representative probleminterval scheduling.Input: set of jobs with start and nish times.Constraint: a single resource that can run at most 1 job at any time.
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 6Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.Shortest paths in graphsshortest path network.(weighted) directed graph G = (V, E)each edge has a length e 0length of a (directed) path = sum of lengths of all e
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 7Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.AnnouncementsMid-term 1 in two weeks (Oct 5)Topics: lectures 1 through 7 (MST)Talk to me if you got &lt; 6 points on Homework 1.Spanning treesdenition. spanning t
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 8Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.Clusteringproblem. divide n objects into k groups (a k-clustering) so that objects in differentgroups are as far apart (different) as possible.e.g. categorizing d
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 9Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.AdministrationNext week: MidtermTopics: Lectures 1 through 7, Homework 1 and Exercises 1-4(BFS, Dijkstras, Prims, Kruskals)one double-sided cheat sheet.divide-
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 10Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.divide-and-conquer algorithmsI.closest pair of pointsII. integer multiplication.Closest pair of pointsproblem. given a list of n points in the plane (x1 , y1
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 11Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.AnnouncementsHomework 2 due Oct 24Midterm 2 Nov 2.Algorithmic paradigmsgreedy. build up a solution incrementally, optimizing some local criterion.challenge: w
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 12Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.Second representative problemweighted interval scheduling.Input: set of jobs with start times, nish times and weights.Find max weight subset of non-overlapping j
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 13Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.AnnouncementsScheduleOct 26: Shortest paths | Midterm 2 reviewNov 2: Midterm 2 | Homework 3 outNov 9, 16: Network owsToday: More dynamic programmingNov 30: Mi
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 14Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.Longest common subsequence (LCS)problem. given two strings x, y, nd the longest common subsequence.CATACTHIEROGLYPHOLOGYMICHAELANGELObrute force: try all subs
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 15Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.AnnouncementsMidterm 2 on Nov 2 (Wed)one double-sided cheat sheettopics: greedy (no MST, no clustering), divide-and-conquer, dynamic programming (upto lecture 1
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 16Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.AnnouncementsHomework 3 and 4 are upMidterm 2 : mean 28, median 30, standard deviation 6Midterm 3 on Nov 30Topics: greedy, dynamic programming and network ows.
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 17Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.Reductionscommon theme.transform abstract problem into a graph problemrun a graph algorithm we know.Reductionscommon theme.transform abstract problem into a
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 18Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.Polynomial Time Algorithmsmany tasks can be solved in polynomial time (i.e. O(nc ), where c is a constant)sorting a list of n numbers: O(n log n)minimum spanning
GWU - CSCI - 6212
cfw_CSCI 6212Lecture 19Design and Analysis of AlgorithmsHoeteck Wee hoeteck@gwu.edu.Minimum cutDenitions1. Cut: set of edges whose removal render the graph disconnected2. Minimum cut: cut of the smallest size (size = # edges in the cut)14bd
Syracuse - PSY - 205
PSY205 Personality Ch. 12 What is Personality? - Consistency - Distinctiveness - Personality refers to an individual's unique constellation of consistent behavior traits. Personality Traits - A personality trait is a durable disposition to behave in a par
Syracuse - PSY - 205
PSY205 9/6/11 Biopsychology -Memory, thinking, mental illness Pineal Gland - Where soul exerts it will on the mind Definition: Bios, psyche, logos Rene Descartes (1569-1650) - 5ft 2 - Mathematician, soldier, philosopher - I think therefore I am - People h
Syracuse - PSY - 205
PSY205 9/8/11 John B. Watson - Behaviorism: Any overt o Genetics vs. Environment? Environment - Stimulus Response Psychology vs. Common sense - Is psychology common sense? NO - Common sense is . o Made up after the fact
Syracuse - PSY - 205
PSY205 9/15/11 Carolinne Koller's Presentation Sensations &amp; Preceptions Rene Descartes - La Haye, Touraine, France - Canon &amp; Civil Law - Philo, Psych - Mind, body, soul - Contributed to psychology o Flow of &quot;animal spirit&quot; o Books Meditations on first phi
Syracuse - HST - 112
HST 112Worksheet: Communism, Fascism, National SocialismSovietCommunismItalianFascismIdeologicalUtopian, antifeatures and/or liberal,ideological core socialismClassesNature/style of Communismrulestate controlslife, everyequalNature ofSuppr
Syracuse - PSY - 223
CHAPTER 15 DRUG ADDICTION PSY 223 SPRING 2012HOW ARE DRUGS ADMINISTERED? ORAL INGESTION INJECTION INHALATION ABSORPTION THROUGH MUCOUS MEMBRANESTYPICAL MAINLININGFASTEST WAY TO GET DRUG INTO BRAIN NO CHANCE TO CHANGE BEHAVIORTHE DOSE-RESPONSE CURVE D
Syracuse - PSY - 223
PSY223 Notes 4/23/12 CH.15 Drug Addiction How Are Drugs Administered - ORAL INGESTION - INJECTION - INHALATION - ABSORPTION THROUGH - MUCOUS MEMBRANES Typical Mainlining - Fastest way to get drug into brain - No chance to change behavior Often the more yo
Syracuse - PSY - 335
PSY335Discipline Styles- Power assertiono Physical force or threat of physical force to control behavioro Taking away privileges or possessionso Used by 90% of parentsPower Assertion- Spankingo Boys spanked more often than girlso Mothers do more
Syracuse - PSY - 335
PSY335Early ChildhoodSocial and Emotional DevelopmentSelf Concept- Schema/mental representation of self- All our knowledge about who we are- Beliefs about our attributes &amp; capabilitiesSelf Concept Contents- Internalo Psychological Traitso Feelin
Syracuse - PSY - 335
PSY335Early Childhood:Cognitive Development3/28/12Conservation- After asking children to judge the quantity, length, or number.- When make incorrect judgments, children say:Conservation Errors- Reasoning errors involve Contractiono Thinking about
Syracuse - EAR - 111
EAR111 Recitation Quiz Week of 10/24 1. CO2 dissolves more readily into _. a. Warm water b. Cold water Correct answer: B 2. Which of the following is NOT a reason for ocean circulation? a. Winds b. Salinity of the water c. Temperature of the water d. Oxyg
Syracuse - PSC - 121
PSC121 Quiz 11. Match each of these with the statement below that defines the conceptC LibertyF IndividualismA EqualityE The social contractB ConstitutionalismD CapitalismA. The notion that all individuals are equal in their moral worth and thereb
Syracuse - PSC - 121
PSC121EXAM 1T or F 1. A conservative ideologue is someone who thinks that opportunity in America isno available to enough people and we should expand access to opportunity through moregovernment programsCorrect Answer: FT or F 2. A liberal thinks th
Syracuse - PSC - 121
Nicolas4/6/11Discussion Teacher: JennPSC121MEMOFor next weeks recitation you must write a one-two page memo (per the syllabusrequirements). This memo must be supported with evidence you find in the books especially Bianco and Canon. If there are sp
Syracuse - PSC - 121
PSC 121 Quiz 6ElectionsT F 1. A closed primary is one in which only those registering as a party member can voteCorrect Answer TT F 2. In presidential primaries, Republicans use winner-take-all rules for deciding whowins a states delegates while Demo
Syracuse - PSC - 121
PSC121 Quiz 7Congress1. In 2008 House districts that voted at lower levels for Obama elected:a. Equal percentages of Democrats and Republicansb. More Republicans than Democratsc. More Democrats than RepublicansCorrect Answer: BT F 2. The stimulus b
Syracuse - PSC - 121
PSC121 Quiz 8Congress1. Paul Ryans video says that over the next several decades the debt of the federalgovernment as a percentage of national income will:a Increaseb. Stay about the samec. DecreaseCorrect Answer: A2. The graphic video of tax obli
Syracuse - PSC - 121
PSC121: Quiz 3Civil Liberties and Public Opinion1. The essential reason for our civil liberties is to:a. Restrain citizen so they will operate in a reasonable way within a democracyb. Protect citizens from a government that may intimidate themc. Bala
Miami University - COM - 437*
Bolstering: The new theater productions will include interactive plays, musicals, anddance performances for children to enjoy while parents are gambling, in order to create a family atmosphere. The first underlined sentence is bolstering because we are r
Miami University - COM - 437*
April 23, 2012 Contact Information: John Smith, Communication Director FOR IMMEDIATE RELEASE Office: (609) 451-6102 Fax: (609) 851-5472 Email: john.smith@mamas.com MAMA'S CASINO ADDRESSES RECENT COMMISSION VIOLATIONS ATLANTIC CITY, NJ-The New Jersey Gamin
Miami University - SOC - 265
Professor LuMing Mao April 23, 2012Beyond Bias, Binary, and Border: Enacting a Discursive Third in Comparison RhetoricsProfessor LuMing Mao's lecture consisted of concepts I have never heard of before. He spoke about the &quot;discursive third&quot;, &quot;dao&quot;, &quot;zira
Harvard - STATS - 107
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39FMAGX -0.105296 -0.075943 0.139102 0.136679 0.060516 -0.013755 0.087637 0.02166 0.053087 -0.054276 0.054496 0.03876 -0.043688 0.030076 0.066288 0.0
Harvard - STATS - 107
Stat 107 Spring 2012 HW #5 Solutions1 (a) The following weights are obtained from Excel Solver (note: since we are dealing with minimizing an absolute value, there is NOT ONE UNIQUE SOLUTION, and the weights you get may vary slightly): Description FMAGS
Harvard - STATS - 107
### Prob #2 function##pairs.trade=function(ticker1, ticker2, from=&quot;2007-01-01&quot;, to=Sys.Date(),type=&quot;z.diff&quot;,threshold=2,closeout=T)cfw_ require(quantmod) names=c(ticker1,ticker2) y=getSymbols(ticker1,auto.assign=F,from=from,to=to) x=getSymbols
Harvard - STATS - 107
Stat 107 - Spring 2012 - HW4 SolutionsQuestion 1a)Table 1: Beta from Different Sources Google JNJ 0.53 IBM 0.65 MSFT 1.00 GOOG 1.08 GE 1.58 DIS 1.21 UPS 0.83 MU 1.25 BA 1.22 C 2.56 AAPL 1.25 Yahoo Reuters MM (SPY) 0.45 0.53 0.45 0.60 0.66 0.59 1.05 1.0
Harvard - STATS - 107
Stat 107 Spring 2012 Homework #3 Solutions1. The Portfolio which invests 35.28% in stock A and the rest in stock B gives a higher mean return (42.62%) for the same standard deviation. This is shown below: stock A stock B Portfolio mean 14.25% 62.72% 45.6
Harvard - STATS - 107
Stat 107 Spring 2012Harvard UniversityHomework 2 Solutions 1. GMC Envoys See hw2 q1.R for code. Our goal is to find the order size S that gives us the highest average profit across simulations of D. Given consumer demand D and an order size S, the deale
Harvard - STATS - 107
Interest Initial Deposit Year 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Value8% \$155\$167.40 \$180.79 \$195.26 \$210.88 \$227.75 \$245.97 \$265.64 \$286.89 \$309.85 \$334.63 \$361.40 \$390.32 \$421.54 \$455.27 \$491.69 \$531.02 \$573.50 \$619.38 \$668.93 \$722.4
Harvard - STATS - 107
Stat 107 Spring 2012 Homework 1 Solutions1) 2) 3) 4) 5) See Excel file &quot;Problem 1&quot; See Excel files &quot;Problem 2.1&quot; and &quot;Problem 2.2&quot; See Excel file &quot;Problem 3&quot; See Excel file &quot;Problem 4, 5&quot; See Excel file &quot;Problem 4, 5&quot;6) Note: in this problem, we used th
Harvard - STATS - 107
Harvard - STATS - 107
Harvard - STATS - 107
#1) Style Analysislibrary(quantmod)getSymbols(&quot;VWNDX&quot;,from=&quot;2009-01-01&quot;,to=&quot;2012-03-31&quot;)getSymbols(&quot;VDIGX&quot;,from=&quot;2009-01-01&quot;,to=&quot;2012-03-31&quot;)getSymbols(&quot;VHGEX&quot;,from=&quot;2009-01-01&quot;,to=&quot;2012-03-31&quot;)getSymbols(&quot;VITAX&quot;,from=&quot;2009-01-01&quot;,to=&quot;2012-03-31&quot;)VW
Harvard - STATS - 107
#Pairs Trading Companies:#Home Depot (&quot;HD&quot;) and Lowes (&quot;LOW&quot;)#Papa Johns (&quot;PZZA&quot;) and Dominoes (&quot;DPZ&quot;)#Walmart (&quot;WMT&quot;) and Target (&quot;TRGT&quot;)#McDonalds (&quot;MCD&quot;) and Taco Bell/KFC/Pizza Hut (&quot;YUM&quot;)#Dell (&quot;DELL&quot;) and HP (&quot;HPQ&quot;)#Coke (&quot;COKE&quot;) and Pepsi (&quot;
Harvard - STATS - 107
#1)library(quantmod)f=file.choose() #choosing a file that has the ticker namesthis one has 500 of them!crap=read.csv(f)tickers=as.character(crap[,1])getSymbols(&quot;SPY&quot;, from = &quot;2009-03-01&quot;, to = &quot;2012-02-29&quot;,auto.assign = T)SPY.monthret=monthlyReturn(
Harvard - STATS - 107
#1)#Monthly Returns over last 10+ yearslibrary(quantmod)getSymbols(tickers, from = &quot;2002-01-01&quot;, to = &quot;2012-02-01&quot;) stocks=list(IBM,MCD,KFT,F)means=100*apply(cbind(monthlyReturn(IBM),monthlyReturn(MCD),monthlyReturn(KFT),monthlyReturn(F),2,mean)sds
Harvard - STATS - 107
### Section 1 Code:# Playing with R and quantmod###R can do math:(10.5-12)/(5/sqrt(30)exp(2)sin(pi/6)#R has some built-in functions, that you can pass options (aka, parameters in a comp. sci. sense) to:log(10)log(10, base = 10)#You can store
Harvard - STATS - 107
Stat 107Section #10April 18 &amp; 19, 2012Logistics Kevin Rader, krader@hsph.harvard.edu. Sections: Wed 1-2pm (SC-B10), Thurs 12-1pm (SC-216).Office Hours (SC-602): Wed 2-3pm, Thurs 2-3pm, Fri 1-3pm, Mon 2-3pm, Tues 2-3pm Required Lecture on Thursday (W
Harvard - STATS - 107
Stat 107Section #9April 11 &amp; 12, 2012Logistics Kevin Rader, krader@hsph.harvard.edu. Sections: Wed 1-2pm (SC-B10), Thurs 12-1pm (SC-216).Office Hours (SC-602): Wed 2-3pm, Thurs 1-2pm, Fri 2-3pm Project Proposal: is due Thurs evening by 11:59pm. Plea