6 Pages

hw5-sol

Course: RXC 064000, Fall 2009
School: Dallas
Rating:
 
 
 
 
 

Word Count: 1200

Document Preview

5 Homework Solutions 1. 15-1 (p. 364) Bitonic Euclidean Traveling Salesman Problem 1. Sort the cities using an O(nlogn) sort from the smallest to largest xcoordinate. 2. Suppose city vn is adjacent to city vi. Then we need the shortest path from vi to v1 and then to vn, and then back to vi that includes every other city as well. 3. We define t(i ,j), i < j, to be the shortest path starting from vi, reaching...

Register Now

Unformatted Document Excerpt

Coursehero >> Texas >> Dallas >> RXC 064000

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.
5 Homework Solutions 1. 15-1 (p. 364) Bitonic Euclidean Traveling Salesman Problem 1. Sort the cities using an O(nlogn) sort from the smallest to largest xcoordinate. 2. Suppose city vn is adjacent to city vi. Then we need the shortest path from vi to v1 and then to vn, and then back to vi that includes every other city as well. 3. We define t(i ,j), i < j, to be the shortest path starting from vi, reaching v1, and going back to vj. t(i, j) is computed as follows: t(i, j) = t(i, j-1) + d(vj-1, vj) if j > i + 2 t(i, j) = min{ t(k, i) + d(vk, vj) | if j = i+1 for 1 < k < i 1 d(a, b) is the distance between cities a and b. Note: Because the Traveling Salesman Problem is NP-complete, this yields only an approximate solution. This algorithm is not guaranteed to find the best solution. 2. 9-2 (p. 194) Weighted Median a.) Argue that the median of x1, ... , xn is the weighted median of the xi with weights wi = 1/n. Since all xi have the same weight, the median of x1, ... , xn, the median will be xceiling(n/2). If n is even, then n = 2k. Summing the first k xi-values followed by the second k values yields the same weighted sum for each set: k/n = k/2k = 1/2 The weighted lower median is thus xk = xn/2. If n is odd, then n = 2k + 1. Summing the first k xi-values followed by the second set of k + 1 xi-values yields the following two equations: First k xi: Second k+1 xi: k/n = k/(2k+1) < 1/2 (k+1)/n = (k+1)/(2k+1) > (k+1)/(2k+2) = 1/2 The weighted lower median is thus thus xk = xn/2 = xceiling(n/2) since n is odd. b.) Show how to compute the weighted median of n elements in O(nlogn) worst-case time using sorting. 1. Sort the xi such that w1< ... < wn. 2. sum 0 3. for j 1 to n a. sum sum + wj. i. if sum > 1. return xj-1 Complexity: Sorting can be accomplish in O(nlogn) time using your favorite O(nlogn) sorting algorithm. Initializing the sum variable can be done in O(1) time. In the worst case, the for loop iterates n times. All of the operations inside of the for loop are O(1). Therefore, the total time complexity is: T(n) = O(nlogn) + O(1) + O(n)O(1) = O(nlogn) d.) Argue that the weighted median is a best solution for the one-dimensional post office location problem, in which points are simply real numbers and the distance between points a and b is d(a, b) = |a b|. Note: In the original weighted mean problem, element xi had one attribute: weight wi. In the one-dimensional weighted median problem, post office (element) pi has two attributes: weight wi, and one-dimensional position coordinate pi. Weighted median is a property that depends only on weights. Our goal is to find a value for p that minimizes: wi d ( p, pi ) = wi | pi - p | i =1 i =1 n n This value indicates the optimal coordinate at which to place the new post office p. We are asked to show that the p that minimizes the objective function is the weighted median. The weighted median one of the pi, which we can see from the definition of weighted median. Suppose the weighted median of the post offices is pk. Assume to the contrary that the value for p that minimizes the weighted distance is not pk. We must consider two cases: (1) (2) p = pk + p = pk Let D be the weighted distance when p = pk, D1 be the weighted distance when p = pk + , and D2 be the weighted distance when p = pk . D = wi pi - p k = w1 ( p1 - p k ) + w2 ( p 2 - p k ) + ... wn + ( p n - p k ) D1 = wi pi - ( p k + ) = w1 ( p1 - p k - ) + w2 ( p 2 - p k - ) + ... + wn ( p n - p k - ) D2 = wi pi - ( p k - ) = w1 ( p1 - p k + ) + w2 ( p 2 - p k + ) + ... + wn ( p n - p k + ) i =1 i =1 n i =1 n n k n D1 - D = wi - wi = (w1 + ... + wi ) - (wi +1 + ... + wn ) i =1 i = k +1 n k D2 - D = wi - wi = (wi +1 + ... + wn ) - (w1 + ... + wi ) i = k +1 i =1 Since pk is weighted median, 1 k wi = (w1 + ... + wi ) 2 i =1 n 1 wi = (wi +1 ... + ...wn ) 2 i = k +1 Therefore: D1 D > 0 D2 D < 0 D is a better solution than either D1 or D2. Therefore = 0 is the best solution. In both cases, p = pk. 3. 16.1-3 (pg. 379) Suppose that we have a set of activities to schedule among a large number of lecture halls. We wish to schedule all activities using a few lecture halls as possible. Give an efficient greedy algorithm to determine which activity should use which hall. Note: Although the problem didn't explain this, both the scheduling problem and the graph coloring problem are NP-Complete. Therefore, no perfect solution to either problem can be guaranteed in polynomial time. Our algorithm works as follows: 1. Sort the activities in terms of length, such that the longest activity is at the front of the list. 2. Select the longest activity from the front of the list. Place it in a lecture hall. 3. Process each activity in the list, stating with the second-longest activity. 4. If it is possible to schedule this activity in one of the already-allocated lecture halls, schedule it there. Otherwise, open a new lecture hall and schedule the activity in the new hall. In the worst case, each activity must be placed in its own hall. Therefore, the kth largest activity will have to determine that it cannot fit into any of the k-1 lecture halls that have already been appropriated. Therefore, the worst-case complexity is O(n2) if a total of n activities must be scheduled. 16.2-5 (pg. 384) Describe an efficient algorithm that, given a s...

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:

Dallas - RXC - 064000
Y ` dq q p uu q j uh p qu ku g g u x XthdH3n i hrdWXWgdh8ny x Xq q yz d sq qx sq ld uh p qih f phx ` lhx s ` g u x ` ` b h s ld x g dhx i s pxh g g u x ` tcV9tm$XVWcrywpyp u eo3tq q ycXtu$y9ycypXwy x Xq q yz ` g qu g s k q gd d sq q q gdi
Dallas - RXC - 064000
p t t f if { e i tf {e { e { e wcwoWeook|ocxW'lurkkiforRU eh e p i p m ihe e i f{e i e y h ehe h | fj e {h e rkqoCWrq'xkWurkkik#o~rC%xCrlrCCCellUWzogf! p je i{j ee i e ijj{ f i he h f{ f i{f rRlkjWuWrgk~rx
Dallas - RXC - 064000
Lecture 12: P vs NPProf. BloomSome Solutions Exercises1. 25.1-3. What does the matrix L(0) = . . . . . . 0 0 . . . 0 . . .correspond to in normal matrix multiplication? Answer: the identity matrix. 2. 25.1-5 Show how to expr
Dallas - RXC - 064000
Dynamic ProgrammingDynamic Programming1Outline and ReadingMatrix ChainProduct (5.3.1) The General Technique (5.3.2) 01 Knapsack Problem (5.3.3)Dynamic Programming2Matrix ChainProductsDynamic Programming is a general algorithm design pa
Dallas - RXC - 064000
Memory AllocationCS 217Memory Allocation Good programmers make efficient use of memory Understanding memory allocation is importantCreate data structures of arbitrary size Avoid memory leaks Run-time performance Memory What is memory?Sto
Dallas - RXC - 064000
Enumerating All PermutationsEnumerate all permutations of a set of elements.sEnumerating All PermutationsEnumerate all permutations of a set of elements.sN elements N! possibilities If elements named a, b, c, then 6 possible permutations are
Dallas - RXC - 064000
5. Process Improvement5. Process Improvement1. Introduction 1. Definition of experimental design 2. Uses 3. Steps 2. Assumptions 1. Measurement system capable 2. Process stable 3. Simple model 4. Residuals well-behaved3. Choosing an Experimental
Dallas - RXC - 064000
6. Process or Product Monitoring and Control6. Process or Product Monitoring and ControlThis chapter presents techniques for monitoring and controlling processes and signaling when corrective actions are necessary. 1. Introduction 1. History 2. Pr
Dallas - RXC - 064000
2. Measurement Process Characterization2. Measurement Process Characterization1. Characterization 1. Issues 2. Check standards 2. Control 1. Issues 2. Bias and long-term variability 3. Short-term variability 3. Calibration 1. Issues 2. Artifacts 3
Dallas - RXC - 064000
3. Production Process Characterization3. Production Process CharacterizationThe goal of this chapter is to learn how to plan and conduct a Production Process Characterization Study (PPC) on manufacturing processes. We will learn how to model manuf
Dallas - RXC - 064000
1. Exploratory Data Analysis1. Exploratory Data AnalysisThis chapter presents the assumptions, principles, and techniques necessary to gain insight into data via EDA-exploratory data analysis. 1. EDA Introduction 1. What is EDA? 2. EDA vs Classica
Dallas - RXC - 064000
8. Assessing Product Reliability8. Assessing Product ReliabilityThis chapter describes the terms, models and techniques used to evaluate and predict product reliability. 1. Introduction 1. Why important? 2. Basic terms and models 3. Common difficu
Dallas - RXC - 064000
7. Product and Process Comparisons7. Product and Process ComparisonsThis chapter presents the background and specific analysis techniques needed to compare the performance of one or more processes against known standards or one another. 1. Introdu
Dallas - RXC - 064000
I feel this is something that everyone should know. This is the basis of how a shell works.1. fork() - system call which creates a new process which is identical to the current process. Differences are dependent on the implementation but consider
Dallas - RXC - 064000
# robots.txt for http:/www.eng.hawaii.edu/# Created on February 9, 1996# Ben Y. Yoshino# University of Hawai`i at Manoa# College of Engineering, Computer Facility# used to disallow robot traversal of certain hierarchies within this server# we
Dallas - CAT - 2006
Course DescriptionsProseminarsHCS 6302 Issues in Behavioral and Brain Sciences - Part I (3 semester hours) Doctoral proseminar on current theory and research in Cognition and Neuroscience, Communication Sciences and Disorders, and Psychological Sci
Dallas - CAT - 2006
Back to Catalog Contents _Department of Chemistryhttp:/www.utdallas.edu/dept/chemistry/FacultyRobert A. Welch Chair in Chemistry; Professor of Chemistry: Ray H. Baughman Cecil and Ida Green Distinguished Chair in Systems Biology; Professor o
Dallas - CAT - 2006
Master of Science in International Political Economy FacultyProfessors: Sheila Amin de Gutirrez de Pieres, Brian J.L. Berry, Kurt Beron, Lloyd Jeff Dumas, Euel Elliott, Paul Jargowsky, Murray Leaf, Todd Sandler, Richard Scotch Associate Professors:
Dallas - CAT - 2006
Graduate Program in Applied Cognition and Neurosciencehttp:/bbs.utdallas.edu/FacultyProfessors: Herv Abdi, Peter Assmann, James C. Bartlett, W. Jay Dowling,. , George M. Gerken (emeritus), Richard M. Golden, Susan W. Jerger, Aage R. Mller, George
Dallas - CAT - 2006
Course DescriptionsCore CoursesACN 6330 (HCS 6330) Cognitive Science (3 semester hours) Cognitive and neural processing approaches to understanding perception, attention, memory, thought, and language. (3-0) Y ACN 7344 (HCS 7344) Functional Human N
Dallas - CAT - 2006
Materials Science and Engineering Course DescriptionsCORE COURSES MSEN 5310 Thermodynamics of Materials (3 semester hours) Work, energy and the first law of thermodynamics; the second law of thermodynamics, thermodynamic potentials, the third law of
Dallas - CAT - 2006
Master of Science in Applied Sociologyhttp:/www.utdallas.edu/dept/socsci/FacultyProfessors: Donald A. Hicks, Murray J. Leaf, Kimberly Kempf-Leonard, Lawrence J. Redlinger, Richard K. Scotch, Paul Tracy Associate Professors: Bobby C. Alexander, Ph
Dallas - CAT - 2006
Graduate Program in the Humanitieshttp:/www.utdallas.edu/dept/ah/FacultyProfessors: Alex Argyros, Charles R. Bambach, Richard Brettell, David F. Channell, Milton A. Cohen, Fred I. Curchack, R. David Edmunds, Dennis M. Kratz, Thomas Linehan, Enric
Dallas - CAT - 2008
Adopted January 2006Appendix III Rules and Regulations for Determining Residence StatusSection 21.727. 21.728. 21.729. 21.730. 21.731. 21.732. 21.733. 21.734. 21.735. 21.736. 21.727.Authority and Purpose. Definitions. Effective Date of Subchapte
Dallas - CAT - 2004
Doctor of Philosophy in Geospatial Information Scienceshttp:/www.utdallas.edu/dept/socsci/ This degree program is jointly offered by the School of Social Sciences, the School of Natural Sciences and Mathematics (specifically in the Department of Geo
Dallas - CAT - 2004
Back to Catalog Contents Geosciences Courses Graduate programs in Biology, Chemistry, Geosciences, Mathematical Sciences, Physics, Science/Mathematics Education, Interdisciplinary Programs, BiotechnologyDepartment of Geoscienceshttp:/www.utdal
Dallas - CAT - 2004
Back to Catalog Contents Applied Cognition And Neuroscience Courses Graduate Programs in Applied Cognition and Neuroscience, Communication Disorders, Human Development &amp; Early Childhood Disorders, Human Development &amp; Communication Sciences, Audio
Dallas - CAT - 2004
1. Back to Catalog Contents 2. Human Development and Early Childhood Disorders Courses 3. Graduate Programs in Applied Cognition and Neuroscience, Communication Disorders, Human Development &amp; Early Childhood Disorders, Human Development &amp; Communicati
Dallas - CAT - 2004
Geographic Information Sciences Course DescriptionsGISC 5317 Computer Programming for GIS (3 semester hours) General introduction to Visual Basic and other languages with GIS related applications. Topics covered include fundamental data structures a
Dallas - CAT - 2006
Course DescriptionsCore CoursesACN 6330 (HCS 6330) Cognitive Science (3 semester hours) Cognitive and neural processing approaches to understanding perception, attention, memory, thought, and language. (3-0) Y ACN 7344 (HCS 7344) Functional Human N
Dallas - CAT - 2006
Department of Computer Sciencehttp:/www.utdallas.edu/dept/cs/FacultyProfessors: Farokh Bastani, Ramaswamy Chandrasekaran, Ding-Zhu Du, Andrs Farag, Gopal Gupta, Dung T. Huynh, Dan Moldovan, Simeon C. Ntafos, Balaji Raghavachari, Hsing-Mean (Edwin
Dallas - CAT - 2006
Course DescriptionsProseminarsHCS 6302 Issues in Behavioral and Brain Sciences - Part I (3 semester hours) Doctoral proseminar on current theory and research in Cognition and Neuroscience, Communication Sciences and Disorders, and Psychological Sci
Dallas - CAT - 2006
Geosciences Graduate Catalog, February 27, 2007 FacultyProfessors: Carlos L. V. Aiken, David E. Dunn (emeritus), Anton L. Hales (emeritus), William I. Manton, George A. McMechan, Richard M. Mitterer, Dean C. Presnall (emeritus), Robert H. Rutford (e
Dallas - CAT - 2006
Materials Science and Engineering Course DescriptionsCORE COURSES MSEN 5310 Thermodynamics of Materials (3 semester hours) Work, energy and the first law of thermodynamics; the second law of thermodynamics, thermodynamic potentials, the third law of
Dallas - CAT - 2006
Course DescriptionsPHYS 5100 Current Topics In Physics (1 semester hour) Study of current research topics in physics. (P/F grading, may be repeated for credit.) (1-0) R PHYS 5V49 Special Topics In Physics (1-6 semester hours) Topics may vary from se
Dallas - CAT - 2006
Graduate Program in the Humanitieshttp:/www.utdallas.edu/dept/ah/FacultyProfessors: Alex Argyros, Charles R. Bambach, Richard Brettell, David F. Channell, Milton A. Cohen, Fred I. Curchack, R. David Edmunds, Gavin R.G. Hambly, Dennis M. Kratz, Th
Dallas - CAT - 2006
Computer Engineering Course DescriptionsCS 5303 Computer Science I (3 semester hours) Computer science problem solving. The structure and nature of algorithms and their corresponding computer program implementation. Programming in a high-level block
Dallas - CAT - 2006
Department of Electrical Engineeringhttp:/www.utdallas.edu/dept/eeFacultyProfessors: Larry P. Ammann, Poras T. Balsara, Andrew Blanchard, Cyrus D. Cantrell III, David E. Daniel, John P. Fonseka, William R. Frensley, Andrea F. Fumagalli, Bruce Gna
Dallas - CAT - 2006
Department of Computer Sciencehttp:/www.utdallas.edu/dept/cs/FacultyProfessors: Farokh Bastani, Ramaswamy Chandrasekaran, Ding-Zhu Du, Andrs Farag, Gopal Gupta, Dung T. Huynh, Dan Moldovan, Simeon C. Ntafos, Balaji Raghavachari, Hsing-Mean (Edwin
Dallas - CAT - 2006
Department of Molecular and Cell Biologyhttp:/utdallas.edu/nsm/biology/FacultyProfessors: Hans Bremer (emeritus), Lee A. Bulla, Santosh R. DMello, Rockford K. Draper, Juan E. Gonzlez, Steven R. Goodman, Donald M. Gray, Betty S. Pace, Lawrence J.
Dallas - CAT - 2004
Back to Catalog Contents Telecommunications Engineering Course Listing Graduate programs in Computer Science, Electrical Engineering, Computer Engineering, Telecommunications Engineering, Industrial PracticeGraduate Program in Telecommunication
Dallas - YXH - 052000
Yue He, Initiated Date: 2/15/2007 Implemented Functions: Blocking Bandwidth, Handling CAC failure, PathErr Message Mechanism, FloodingReviewing the simulation:A figure of the whole process is as following: Trigger CAC and PathError if not succeede
Dallas - YXH - 2007
Yue He, Initiated Date: 2/15/2007 Implemented Functions: Blocking Bandwidth, Handling CAC failure, PathErr Message Mechanism, FloodingReviewing the simulation:A figure of the whole process is as following: Trigger CAC and PathError if not succeede
Dallas - POST - 883
NCT COG Regional Police AcademyBasic Instructor CourseCredit Card Fraud: Minimize Your RiskInstructor: Roger Stearns Criminal Investigator with UT PoliceUniversity of Texas at Dallas Ten Years of service in Campus Law Enforcement &amp; Security
Dallas - POST - 883
Welcome BackCredit Card &amp; Debit Card FraudPossible Affects on VictimsFinancial Loss Damage to credit report Wrongful warrant/arrest Potential legal fees. Additional inconvenience of timeHow can you minimize your risk?Check Your StatementOpe
Dallas - POST - 883
LESSON PLAN COVER SHEETCOURSE: INSTRUCTIONAL UNIT: INSTRUCTOR: TCLEOSE Basic Instructor Course Credit Card Fraud: Minimize Your Risk Roger Stearns, Investigator University of Texas at Dallas Police Department 2601 N Floyd Road (PG-11) Richardson, TX
Dallas - POST - 883
# STATUSNAMEIDINTERNSHIP CREDIT=001 Squad Leader Tom Lee 002 Asst Squad Leader Leslie Elliot6 credit hours003 Explorer John Frensley004 Explorer Brian Hills 005 Explorer Benjamin Lotzer006 Explorer Keith Mattson 007 E
Penn State - JTK - 187
Feed and the Medias Effects upon Individuality Unit Title/ Theme: Media Student Name: Lauren Baker, Max Feldman, Danielle Greene, Jonathan Klingeman Rationale One of the major themes that Feed deals with is the effect of the media upon the characters
Penn State - JTK - 187
&quot;A Raisin in the Sun&quot; Pre-Reading LessonPrior to the class beginning to read the play &quot;A Raisin in the Sun&quot;, we will use two outside texts to discuss a few of the larger themes in the reading as well as to connect the play to the rest of the unit. F
Penn State - JTK - 187
The Pennsylvania StateProducer Assistant Director Technical Director Dr. Tony M. Lentz Kristen Rowe Brenton DeFlitchUniversity Readers, CAS 480 ClassPresentsThe CrewThe Pennsylvania State UniversitySpecial Thanks ToThe Schlow Centre Regio
Penn State - JTK - 187
Day Two: Civil Disobedience Read: Roll of Thunder, Hear My Cry, page 21 (beginning with Now Miss Crocker) through page 31, aloud using jump in reading. Teacher: Have you ever heard of the term civil disobedience before? Civil disobedience encompasses
Penn State - JTK - 187
A Raisin in the Sun Debate: -2 Class Periods-Should the word Nigger or any form of it be used in todays culture? Objective: Students will learn to formulate arguments based on both their prior knowledge and interpretations of the text. They will demo
Penn State - JTK - 187
Assessment: Social Injustice &amp; Identity Unit Plan Through the course of this unit, students will be asked to actively participate everyday during class activities. A variety of different assessments will be used to analyze the progression of each stu
Penn State - JTK - 187
Day Four and Five: Research ProjectRESEARCH (kinda) PROJECTTask #1: Select an historical event in which a person or persons stood up for what they believed. In no way shape or form does this need to involve the Civil Rights Movement or focus aroun
Penn State - JTK - 187
Lesson Plan Three: Expression is Everything Topic: Poetry and arts in the Harlem Renaissance and across society Objectives: Conclude A Raisin in the Sun through bringing in other modes of expression (poetry; music) Practice writing poetry Become m
Penn State - JTK - 187
A Raisin the Sun Making a Raisin LessonObjective: To discuss the topic of identity, both the personal identity of the students as well as and in connection to the characters in the book. When considering the broader theme of the unit, it is importan
Penn State - JTK - 187
Penn State - JTK - 412
Penn State - JTK - 187
Penn State - JTK - 412
Penn State - JTK - 412
Reading &amp; Writing PoetryJonathan Klingeman jtk187@psu.edu Mt. Nittany Middle School March 29, 2007Learning Objectives By the end of the class period, students will: Write, respond and react to each other's poems. Understand requirements of I-mo