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.

4 Pages

test02_sol

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

Word Count: 704

Document Preview

Algorithmic COMP108 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 10 3 a 4 8 2 f e (a) Using Kruskal's algorithm, draw a minimum spanning tree (MST) of the graph. Write down the order of the edges selected. If there is more than one...

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 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 10 3 a 4 8 2 f e (a) Using Kruskal's algorithm, draw a minimum spanning tree (MST) of the graph. Write down the order of the edges selected. If there is more than one solution, you only need to give one of the solutions. Answer: b 3 a 2 f e Order of selection: (b, f ), (f, e), (a, b), (c, d), (c, f ) 2 4 c 4 d 2 4 4 6 4 d 1 (b) Using Dijkstra's algorithm, find the shortest paths from the vertex a to all other vertices. Show the intermediate steps of how labels are changed. Answer: (3, a) (, -) (9, f ) (13, b) (, -) b 3 a 4 2 4 c (9, f ) (10, e) (, -) 4 f (, -) (8, a) d (5, b) e (, -) (4, a) Step 0: The label of a is (0, a); every other vertex is (, -). The vertex a is the source. Step 1: The label of b becomes (3, a); f (8, a); and e (4, a). The edge (a, b) is chosen. Step 2: The label of c becomes (13, b); f (5, b). The edge (a, e) is chosen. Step 3: The label of d becomes (10, e); f unchanged. The edge (b, f ) is chosen. Step 4: The label of c becomes (9, f ); d (9, f ). The edge (f, c) is chosen. Step 5: No label is changed. The edge (f, d) is chosen. [40 marks] 2 2. We are given a positive integer x and we want to find the digit that appears the most frequent. For example, if the given integer x is 456566, then 6 is the digit that appears the most frequent. Suppose the integer x is stored in an array of characters X[ ]. For example, if x is 456, then X[0] = 4, X[1] = 5, X[2] = 6. (a) Design and write a pseudo code algorithm countOcc(int [ ]X, int index) that returns the number of occurrences of X[index] in X[ ]. For example if X stores the integer 456566, then countOcc(X, 0) should return 1 because X[0], which equals to 4, appears once; countOcc(X, 1) should return 2 because X[1], which equals to 5, appears twice; etc. The expected output for different values of index is in shown the table below. If X stores 456566, index 0 1 2 3 X[index] 4 5 6 5 countOcc(X, index) 1 2 3 2 4 5 6 6 3 3 (b) Using the algorithm in (a) or otherwise, design and write a pseudo code to output the digit that appear the most frequent in the integer x. If there is more than one such digit, output any one of them. (c) What is the time complexity of the overall algorithm in terms of the number of digits of x? Answer: (a) Algorithm countOcc(int[ ] X, int index) count = 0 len = size of X for i = 0 to len - 1 do begin if X[index] == X[i] then count + + end return count (b) max = 0 max loc = 0 len = size of X for i = 0 to len - 1 do begin occ = countOcc(X, i) if occ > max then begin max = occ max loc = i end end output X[max loc] + " appears most frequently." (c) The time complexity of the algorithm is O(n2 ), where n is the number of digits in x. [30 marks] 3 3. Consider the following recurrence Bn . if n = 0, 1 Bn = 2(2n - 1) Bn-1 if n > 0. The first few numbers Bn for n = 0, 1, 2, 3, 4 are 1, 2, 12, 120, 1680, respectively. (a) Recall that 0! = 1 and n! = n(n - 1)(n - 2) 3 2 1 = n (n - 1)!. Show that for any (2k + 2)! (2k)! positive integer k, = 2(2k + 1) . (k + 1)! k! (2n)! (b) Using (a)...

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:

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
Wilfrid Laurier - EDER - 677
Kristas EDER 677 Journal Entry for Session 11: Instructional and Digital DesignBalancing Synchronous Activities with Distance Educations Flexibility Diverse Populations Before I read Qing and Brads paper (Li &amp; Johnson, 2004) I had not thought of ou
Wilfrid Laurier - EDER - 677
Notes about Toxic Mold Course on Blackboard Course is a continuing education course for architects registered in Ontario. OAA Continuing Education (OAA ConEd) requires 100 points over 2 years, 80 selfdirected and 20 OAA directed. OAA-directed oppo
Wilfrid Laurier - EDER - 677
Kristas EDER 677 Journal Entry for Session 8: Communities OnlineEvaluation of the Breast Cancer Action of Nova Scotia I chose to evaluate the Breast Cancer Action of Nova Scotia website. Unfortunately the visual design of this website detracts from