# 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.

5 Pages

### exam05_sol

Course: COMP 108, Fall 2009
School: East Los Angeles College
Rating:

Word Count: 882

#### Document Preview

Algorithmic COMP108 Foundations Examination 2004-05 Suggested solutions Question 1 Solution 1A. The trace table for m = 5 and n = 3. Before while loop 1st iteration 2nd iteration 3rd iteration i x s 0 1 0 1 5 5 2 25 30 3 125 155 The output of the algorithm for m = 5 and n = 3 is 155. In general, the algorithm outputs m + m2 + m3 + . . . + mn . The time complexity of the algorithm is O(n). [Mark distribution:...

Register Now

#### Unformatted Document Excerpt

Coursehero >> California >> East Los Angeles College >> COMP 108

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.
Algorithmic COMP108 Foundations Examination 2004-05 Suggested solutions Question 1 Solution 1A. The trace table for m = 5 and n = 3. Before while loop 1st iteration 2nd iteration 3rd iteration i x s 0 1 0 1 5 5 2 25 30 3 125 155 The output of the algorithm for m = 5 and n = 3 is 155. In general, the algorithm outputs m + m2 + m3 + . . . + mn . The time complexity of the algorithm is O(n). [Mark distribution: trace table 6 marks, general output 2 marks, time complexity 2 marks] 1B. I. Table of edges in ascending order of costs. edge (a, b) (e, f ) cost 1 1 edge (b, h) (e, h) cost 3 3 PSfrag replacements II. The MST: b a (b, f ) (c, e) 2 2 (c, h) (f, h) 4 5 c d e (a, f ) (b, c) 3 3 (c, d) (d, e) 8 9 h f Order of edges selected: (a, b), (e, f ), (b, f ), (c, e), (b, h), (c, d). (The order of the underlined pairs can be swapped, and (b, h) can be replaced by (e, h).) III. The MST is not unique. IV. Because the costs of the edges are all distinct, the MST must be unique. [Mark distribution: (I) 3 marks, (II) 7 marks, (III) 2 marks, (IV) 3 marks.] 1 Question 2 Solution 2A. count = 0 for i = 0 to n m do begin j=0 while j < m and S[i + j] == T [j] do j =j+1 if j == m then count = count + 1 end if count == 1 then output T is a unique substring of S else output T is not a unique substring of S Time complexity: The outer for-loop iterates for O(n) times, and each inner while-loop iterates for O(m) times. Therefore, the time complexity of this algorithm is O(nm). [Mark distribution : Report substring 5 marks, Report unique substring 6 marks, Time complexity 4 marks] 2B. To show that 3n2 log n + 2n2 + 5n + 1 is O(n2 log n), we show that For any integer n > 1, 3n2 log n + 2n2 + 5n + 1 cn2 log n for some constant c. Notice that for any integer n > 1, 1 log n n. Therefore, 2n2 2n2 log n (because 1 log n), 3n2 log n 3n2 log n, 1 n2 log n (because 1 log n and n > 1). 5n 5n2 log n (because 1 log n and n > 1), and As a result, 3n2 log n + 2n2 + 5n + 1 11n2 log n for all n > 1. Since 11 is a constant, the function 3n2 log n + 2n2 + 5n + 1 is O(n2 log n). [Mark distribution : correct approach 4 marks, state that 1 log n n 2 marks, correct constant c 2 marks, correct minimum value of n 2 marks] 2 Question 3 Solution 3A. I. O(n5 ) II. O(n4 ) III. O(n3 log n) IV. O( n) or O(n1/2 ) V. O( n3 ) or O(n3/2 ) [Mark distribution: 2 marks each.] 3B. Denote the statement n k=1 (2k + 1) = n(n + 2) as p(n). Basic step / Base case : For n = 1, n (2k + 1) = 3. k=1 On the other hand, n(n + 2) = 3. Therefore, p(1) is true. Induction step : Assume that p(n) true is for some positive integer n. Consider the case for n + 1. n+1 (2k + 1) k=1 n = k=1 (2k + 1) + 2(n + 1) + 1 n(n + 2) + 2n + 3 n2 + 2n + 2n + 3 n2 + 4n + 3 (n + 1)(n + 3) (by I.H.) = = = = Therefore, p(n + 1) is also true. By the principle of M.I., the statement p(n) is true for all positive integers n. [Mark distribution: base case 2 marks, state the induction hypothesis 2 marks, induction step 6 marks.] 3C. I. A decision problem is a computational problem for which the output is either yes or no. In an optimisation problem we try to maximise or minimise some value (the objective function). II. (a) is an optimisation problem, (b) is a decision problem. III. Any NP-complete problem: CNF-SAT, 3-SAT, Vertex Cover, etc. [Mark distribution: (I) 2 marks (II) 0.5 mark each, (III) 2 marks.] 3 Question 4 Solution 4A. T (n) = = = = = = = = = 3T (n 1) + 1 3(3T (n 2) + 1) + 1 32 T (n 2) + 3 + 1 32 (3T (n 3) + 1) + 3 + 1 33 T (n 3) + 32 + 3 + 1 . . . 3n1 T (1) + 3n2 + . . . 32 + 3 + 1 3n1 + 3n2 + . . . 32 + 3 + 1 because T (1) = 1 n (3 1)/(3 1) (3n 1)/2 [Mark distribution: the rst few iterations 4 marks, expressed in terms of T (1) and use of T (1) 7 marks, correct nal formula 4 marks.] 4B. I. The degree of the graph is 3. II. One possible DFS traversal: a, b, c, d, f , e, h, g III. One possible BFS traversal: a, b, h, c, g, d, f , e [Mark distribution: I 1 mark, II & III 2 marks each.] 4C. I. The sum of in-degree is 7 and the sum of out-degree is also 7. II. The sum of in-degree over all vertices = the sum of out-degree ...

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:

East Los Angeles College - COMP - 108
COMP108DEPARTMENT : Computer Science Tel. No. 795-4257MAY 2007 EXAMINATIONSBachelor of Arts : Year 1 Bachelor of Science : Year 1 Bachelor of Science : Year 2 Master of Engineering : Year 1 No qualication aimed for: Year 1ALGORITHMIC FOUNDATI
East Los Angeles College - COMP - 108
COMP108 Algorithmic Foundations Tutorial 3 (Suggested Solution)8 February 20081. (a) Base case: When n = 0, L.H.S = x0 = 1, R.H.S = (x1 1)/(x 1) = 1 = L.H.S Therefore, statement is true for n = 0 Induction hypothesis: Assume the statement is true
East Los Angeles College - COMP - 108
COMP108 Algorithmic Foundations Class Test 2 (Friday 18 April 2008)Name: ID:Answer ALL questions. Use the space provided and the back page if necessary. 1. Consider the following graph G. The label of an edge is the cost (weight) of the edge. b c
Sveriges lantbruksuniversitet - BISC - 309
Background knowledge expected Population growth models/equations exponential and geometric logistic Refer to 204 or 304 notes Molles Ecology Chs 10 and 11 Krebs Ecology Ch 11 Gotelli - Primer of Ecology (on reserve)The ecology of small populations
East Los Angeles College - COMP - 108
COMP108 Algorithmic Foundations Assessment 1Suggested solutions1. Target: to prove that 2n3 + n3 log n + 3n2 log n + n2 + 3n + 2 log n + 5 is O(n3 log n). 2n3 n3 log n for all n 4, 3n2 log n n3 log n for all n 3, n2 n3 log n for all n 2,
East Los Angeles College - COMP - 108
COMP108 Continuous AssessmentClass Test 1 (avg 62%) 12 Assessment 1 (avg 64%) Test 2 (avg 57%) Assessment 2 (avg 78%)10861148 7 6 5 5 3 0E or below D5 3 15 3 2 3 2 3 35 5 55 4 3 35 4 220CBAA+A+
Sveriges lantbruksuniversitet - BISC - 404
Reproductive and life history strategies Pollination syndromes Breeding systems Plant Gender and Mating systems Timing/frequency of reproduction Seed dispersal and dormancyParts of a FlowerPollination syndromesPollination syndromes Statis
East Los Angeles College - COMP - 108
Algorithmic Foundations COMP108COMP108 Algorithmic FoundationsDivide and ConquerPrudence Wonghttp:/www.csc.liv.ac.uk/~pwong/teaching/comp108Algorithmic Foundations COMP108Divide and Conquer Algorithmic FoundationsLearning outcomesCOMP
East Los Angeles College - COMP - 108
Algorithmic Foundations COMP108Algorithmic Foundations COMP108Learning outcomes COMP108 Algorithmic FoundationsGraph TheoryAble to tell what is an undirected graph and what is a directed graphKnow how to represent a graph using matrix and lis
McGill - MUMT - 611
Daniel McEnnisMasters Student in Music Technology at McGill UniveristyHomeFeature Extraction SystemA Java Based ApproachPreliminary design documents for version 0.1Class Diagram Use Case Diagram ProjectProposalPast ProjectsMAT proof command
East Los Angeles College - COMP - 108
Algorithmic Foundations COMP108COMP108 Algorithmic FoundationsGraph TheoryPrudence Wonghttp:/www.csc.liv.ac.uk/~pwong/teaching/comp108Algorithmic Foundations COMP108Learning outcomesAble to tell what is an undirected graph and what is a di
East Los Angeles College - COMP - 108
COMP108 Algorithmic Foundations Tutorial 8 (Suggested Solution)14 March 20081. Refer to the program GraphSol.java from the tutorial page. 2. Select a fruit F from the box Orange &amp; Apple. If the fruit F is an apple, then the box should be labelled
Allan Hancock College - PILACCAR - 20064
[pic] Primary Industries Levies and Charges Collection Amendment Regulations 2006 (No. 4)1 Select Legislative Instrument 2006 No. 193 I, PHILIP MICHAEL JEFFERY, Governor-General of the Commonwealth of Australia, acting with t
East Los Angeles College - COMP - 108
Algorithmic Foundations COMP108COMP108 Algorithmic FoundationsGreedy methods Prudence Wonghttp:/www.csc.liv.ac.uk/~pwong/teaching/comp108Algorithmic Foundations COMP108Greedy methods .Algorithmic Foundations COMP108Learning outcomesUnder
East Los Angeles College - COMP - 108
COMP108 Algorithmic Foundations Tutorial 4 (Suggested Solution)15 February 20081. Refer to the program SearchSol.java from the tutorial page. 2. Refer to the program MatchSol.java from the tutorial page. 3. Divide the eggs into four groups. Weigh
East Los Angeles College - COMP - 108
COMP108 Algorithmic Foundations Tutorial 1018 April 2008Note: If youve spent 10 minutes on a question without any clue of how to proceed, talk to the demonstrator. 1. Suppose there are two assembly lines each with 4 stations, Si,j . The assembly t
Sveriges lantbruksuniversitet - IR - 3461
1ENDLEGISLATED POVERTYN E W S L E T T E RJanuary, 1992IIWe won!Single parents on welfare don't have to look for work or training. The new welfare rule goes into effect immediately. End Legislated Poverty worked for three years to get this
Sveriges lantbruksuniversitet - LIB - 3461
1ENDLEGISLATED POVERTYN E W S L E T T E RJanuary, 1992IIWe won!Single parents on welfare don't have to look for work or training. The new welfare rule goes into effect immediately. End Legislated Poverty worked for three years to get this
East Los Angeles College - COMP - 108
Algorithmic Foundations COMP108COMP108 Algorithmic FoundationsAlgorithm efficiency + Searching/SortingPrudence Wonghttp:/www.csc.liv.ac.uk/~pwong/teaching/comp108Algorithmic Foundations COMP108Learning outcomesAble to carry out simple asym
Sveriges lantbruksuniversitet - IR - 3471
(TND LEGISLATED#53The B. C. government has changed the welfare law about how much money you can have and still apply for welfare. The new law means that you don't have to use up nearly all your savings before you can apply for welfare. If you are a
East Los Angeles College - COMP - 108
COMP108 Algorithmic Foundations Tutorial 7 (Suggested Solution)7 March 20081. Iterative method: T (n) = = = = = = = = = = = = 3 T (n 1) + 1 3 (3 T (n 2) + 1) + 1 32 T (n 2) + 3 + 1 32 (3 T (n 3) + 1) + 32 + 3 + 1 33 T (n 3) + 32 + 3 + 1 33 (3,
Sveriges lantbruksuniversitet - IR - 2605
Evidence Based Library and Information Practice 2006, 1:2 Evidence Based Library and Information Practice Commentary Evidence Based Librarianship and Open Access Heather Morrison Project Coordinator, British Columbia Electronic Libr
Sveriges lantbruksuniversitet - LIB - 2605
Evidence Based Library and Information Practice 2006, 1:2 Evidence Based Library and Information Practice Commentary Evidence Based Librarianship and Open Access Heather Morrison Project Coordinator, British Columbia Electronic Libr
East Los Angeles College - COMP - 108
COMP108 Algorithmic Foundations Tutorial 77 March 2008Note: If you've spent 10 minutes on a question without any clue of how to proceed, talk to the demonstrator. 1. Solve the following recurrence by the iterative method. T (n) = 1 3 T (n - 1) + 1
Sveriges lantbruksuniversitet - IR - 2059
EVIDENCE ON THE BANK LENDING CHANNEL IN UKRAINEInna Golodniuk University Degree in Physics, Chernivtsi National University, 1997 MA in Economics, University of Kyiv-Mohyla Academy, 1999PROJECT SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS
Sveriges lantbruksuniversitet - LIB - 2059
EVIDENCE ON THE BANK LENDING CHANNEL IN UKRAINEInna Golodniuk University Degree in Physics, Chernivtsi National University, 1997 MA in Economics, University of Kyiv-Mohyla Academy, 1999PROJECT SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS
East Los Angeles College - COMP - 108
COMP108 Algorithmic Foundations Tutorial 629 February 20081. Merge sort is a sorting algorithm that divides n numbers into two halves, recursively sorts each of them, and then merge the two resulting sorted lists into a final sorted list. Apply mer
East Los Angeles College - COMP - 108
COMP108 Algorithmic Foundations Assessment 1Deadline: Friday, 7 March 2008 (4pm)(Submit to Student One-Stop-Shop) 1. Prove that the function 2n3 +n3 log n+3n2 log n+n2 +3n+2 log n+5 is O(n3 log n). Remember to explain for each term why it is no mor
East Los Angeles College - COMP - 108
Algorithmic Foundations COMP108COMP108 Algorithmic FoundationsIntroduction + Mathematical InductionPrudence Wonghttp:/www.csc.liv.ac.uk/~pwong/teaching/comp108/200708Algorithmic Foundations COMP108Module information Algorithmic Foundation
East Los Angeles College - COMP - 108
COMP108 Algorithmic Foundations Tutorial 125 January 20081. Simplify the following mathematical expressions (a) (x - 2)(x + 1) + x + 2 (b) x2 + 2x + 1 (d) 2 + log2 (x/4) 2. Give the trace table and the output of the following algorithm for m = 16.
Sveriges lantbruksuniversitet - IR - 1590
Playful Play with Games: Linking Level Editing to Learning in Art and DesignMaia EngeliPlanetary Collegium University of Plymouth UK maia@enge.li ABSTRACT The title Playful Play with Games refers to the possibility of creative involvement with game
East Los Angeles College - COMP - 108
AlgorithmicFoundations COMP108COMP108 AlgorithmicFoundationsDivideandConquerPrude Wong ncehttp:/www.csc.liv.ac.uk/~pwong/te aching/com p108AlgorithmicFoundations COMP108DivideandConquerAlgorithmicFoundationsLearningoutcomesCOMP108 U
East Los Angeles College - COMP - 108
Algorithmic Foundations COMP108COMP108 Algorithmic FoundationsAlgorithm efficiency + Searching/SortingPrudence Wonghttp:/www.csc.liv.ac.uk/~pwong/teaching/comp108Learning outcomes Ableto carry outAlgorithmic Foundations COMP108sim asympt
East Los Angeles College - COMP - 108
Algorithmic Foundations COMP108COMP108 Algorithmic FoundationsIntroduction + Mathematical InductionPrudence Wonghttp:/www.csc.liv.ac.uk/~pwong/teaching/comp108/200708Algorithmic Foundations COMP108Module information .Teaching TeamDr Prud
East Los Angeles College - COMP - 108
AlgorithmicFoundations COMP108COMP108 AlgorithmicFoundationsGraphTheoryPrude Wong ncehttp:/www.csc.liv.ac.uk/~pwong/te aching/com p108Learningoutcomes Ableto te llAlgorithmicFoundations COMP108what is an undire d graph and what is a cte
East Los Angeles College - COMP - 108
Algorithmic Foundations COMP108COMP108 Algorithmic FoundationsDynamic ProgrammingPrudence Wonghttp:/www.csc.liv.ac.uk/~pwong/teaching/comp108Algorithmic Foundations COMP108Dynamic programmingan efficient way to implement some divide and
Sveriges lantbruksuniversitet - ECON - 305
Problem Set #5 Answer KeyEconomics 305: Macroeconomic Theory Spring 20071Chapter 9, Problem #1There are two eects of an increase in the depreciation rate. First, given the marginal product of capital in period two, M PK , the net marginal prod
East Los Angeles College - COMP - 108
AlgorithmicFoundations COMP108COMP108 AlgorithmicFoundationsGreedymethods Prudence Wonghttp:/www.csc.liv.ac.uk/~pwong/teaching/comp108AlgorithmicFoundations COMP108GreedymethodsLearningoutcomes Unde rstand whatAlgorithmicFoundations COMP
Sveriges lantbruksuniversitet - ECON - 305
Econ 305 Spring 2008 Tutorial Notes 2Chapter 3 3. Correlation a) Positive. b) Negative. c) Negative. d) Positive. e) Politicians would certainly argue that the correlation is positive. Others may be less sure. f) 4. Leads and Lags. a) The cleanlines
East Los Angeles College - COMP - 108
0 1 0 1 1 0 0 0 01 0 1 0 0 1 0 0 00 1 0 0 0 0 0 0 01 0 0 0 0 0 1 1 01 0 0 0 0 0 0 0 00 1 0 0 0 0 0 0 10 0 0 1 0 0 0 0 00 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0
East Los Angeles College - COMP - 108
30 40 30 3050 10 20 1040 20 40 3010 50
Hudson VCC - BOT - 006
Soi l sthe una ppr eci a ted na tur a l r esour ceFr ed M a gdoff D ept. Pl a nt &amp; Soi l Sci enceYou ask me to pl ow the gr ound. Shal l I take a kni fe and tear my mother s br east? Native American ChiefM any a hi l l si de do the tor r ent
East Los Angeles College - COMP - 108
5 2 15 15 4 4 119 1 3 24 7
East Los Angeles College - COMP - 108
0 0 0 1 1 00 0 1 1 0 00 1 0 0 0 01 1 0 0 0 01 0 0 0 0 10 0 0 0 1 0
East Los Angeles College - COMP - 108
0 0 0 1 1 10 0 1 1 0 00 1 0 0 0 01 1 0 0 0 01 0 0 0 0 11 0 0 0 1 0
East Los Angeles College - COMP - 108
COMP108 Algorithmic Foundations Examination 2005-06Suggested solutions Question 1 Solution1A. Adjacency matrix of G: a b c d e f a 0 1 1 1 0 0 b 1 0 1 0 1 1 c d e 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 1 f 0 1 1 1 1 0PSfrag replacements1B. Greedy me
Allan Hancock College - PILACCAR - 2003112003
PRIMARY INDUSTRIES LEVIES AND CHARGES COLLECTION AMENDMENT REGULATIONS 2003 (NO. 11) 2003 NO. 305 PRIMARY INDUSTRIES LEVIES AND CHARGES COLLECTION AMENDMENT REGULATIONS 2003 (NO. 11) 2003 NO. 305 - TABLE OF PROVISIONS1. Name of Regulations 2
Sveriges lantbruksuniversitet - M - 202
lab #9 worksheet-- make a new folder for week 9- files for this week: w9edf1.m w9edf2.m w9edf3.m- start matlab &amp; change to the week 9 folderKEY QUESTION: what is the meaning ofthose goodness-of-fit quantities, W^2 and r^2?warm-u
Sveriges lantbruksuniversitet - APMA - 930
Integral Equations Arising From the Incompressible Navier-StokesBryan QuaifeDepartment of Mathematics, SFUthe boundary data. However, I am able to impose either Neumann or Dirichlet boundary data for the full fourth order problem with an integral
Sveriges lantbruksuniversitet - M - 251
Simon Fraser UniversityMATH 251: Calculus III Course Outline Fall 2008Instructor: Office: Office Hours: Workshop Hours: Email: Course Web page: Dr. David Muraki SC K10538 by appointment Mondays 1:30-2:30 in AQ 4110 muraki@sfu.ca newton.science.sfu.
Sveriges lantbruksuniversitet - M - 495
Homework #01 MATH495/STAT490 Introduction to Probability Models submit your write-up Wednesday 17 September. participation in webct discussions is encouraged. please respect page limits &amp; remember to Guidelines for Reports.A) Warm-ups from Ros
Sveriges lantbruksuniversitet - M - 462
March 22, 2004 PATENTSFor Speed in Swimsuits, Add BumpsBy TERESA RIORDANARLIER this month at Pressure, a Manhattan nightclub, buff Olympic swimming hopefuls - including 18-year-old Michael Phelps, who won four gold medals at last year's World Ch
Wilfrid Laurier - EDER - 603
Patriarchal Structuralist Rights and Freedoms Liberal Feminism Marxist/ socialist Feminism Critical Theory Enlightenment Essential Feminism Postmodern Radical Feminism Feminist Research Types of FeminismI think, therefore I am Strives to interpret
Wilfrid Laurier - EDER - 603
A Hermeneutic Circle of Epistemologies Reading Ushers (1996) article critiquing epistemological assumptions definitely keeps me travelling on the hermeneutic circle. I keep going around and around these paradigms. I empathize with one paradigm, only
Wilfrid Laurier - EDER - 603
intertextual linguistic constructhistory is less than the past epistemologydiscourse interpretiveWhat History Isinterpretsvalues, positions, ideologies,hermeneutic tied to the historianRemember Hermesrepresentative of the views of the
Wilfrid Laurier - EDER - 603
A full circle This course has been a fantastic experience for me. I finally feel like I understand. Not only do I understand, but I think I can do this. I know that I have to do this. Last year when I started my PhD, I considered words like epistemol
Wilfrid Laurier - EDER - 603
Did I Ever Leave Home?I am scared of getting too excited, but Biesta &amp; Burbules (2003) really makes me feel like I am coming home. Dewy is often cited as the founding theorist for many of my distance education models. I knew of Dewey well before I
Wilfrid Laurier - EDER - 603
Narrative, Biographical and StoryBetter Balance of self and participant Autobiographical Biographical Where is the participants voice Smithbattle (1994) Story is well toldHumans can only interpret themselves within their world Stroobants (2005) A
Allan Hancock College - APTLB - 2001371
1998-1999-2000-2001 The Parliament of the Commonwealth of Australia HOUSE OF REPRESENTATIVES Presented and read a first time Air Passenger Ticket Levy (Collection) Bill 2001 No. , 2001 (Transport and Regional Services) A Bi
Wilfrid Laurier - EDER - 677
Synchronous tools1Evaluation of Synchronous Communication ToolsKaren Chisvin Krista Poscente Denis BeaulieuEDER 677 Distributed Learning University of Calgary For Dr. Qing LiTuesday, October 12, 2004Synchronous tools2Abstract We eval
Wisc La Crosse - MATH - 145
Math 145January 23, 2007Outline1. 2. 3.Recap Other Sampling Designs Graphical methodsStatistics is the science of collecting, analyzing, interpreting, and presenting data.Two kinds of Statistics:1. 2.Descriptive Statistics. Inferenti