3 Pages

tut06

Course: CSC 263, Fall 2009
School: Toledo
Rating:
 
 
 
 
 

Word Count: 668

Document Preview

6: TUTORIAL Disjoint sets ========================= Recall the disjoint sets data structure --------------------------------------- Maintains a collection S = {S_1, S_2,...,S_k} of disjoint sets -> Each set is identified by a representative (some member of the set) Operations: MAKE-SET(x) UNION(x, y) FIND-SET(x) Note: No duplicate elements are allowed! Disjoint set application...

Register Now

Unformatted Document Excerpt

Coursehero >> Ohio >> Toledo >> CSC 263

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.
6: TUTORIAL Disjoint sets ========================= Recall the disjoint sets data structure --------------------------------------- Maintains a collection S = {S_1, S_2,...,S_k} of disjoint sets -> Each set is identified by a representative (some member of the set) Operations: MAKE-SET(x) UNION(x, y) FIND-SET(x) Note: No duplicate elements are allowed! Disjoint set application ------------------------ Example: Determine the connected components of an undirected graph. Graph G: a - b d f - g \ / | | / | c e h i Connected components: {a, b, c}, {d, e}, {f, g, h, i} (Make sure they understand what a graph and component is.) Goal: Given vertices v_1 and v_2 determine whether they belong to the same component Question: How do you use disjoint sets to solve this problem? (Let them guess the answer.) Connected_Components(G): for each vertex v \in V[G] do MAKE_SET(v) for each edge (u,v) \in E[G] do if FIND_SET(u) \neq FIND_SET(v) then UNION(u,v) Same_Component(u,v): if FIND_SET(u) = FIND_SET(v) then return true else return false Run this algorithm on the graph above. Edge processed Collection of disjoint sets {a}, {b}, {c}, {d},... (a,b) {a,b}, {c}, {d},.... (a,c) {a,b,c},{d},{e},.... (b,c) {a,b,c},{d},{e},.... (d,e) {a,b,c}, {d,e}, {f}, {g},.... etc. (Finish this example if they are interested.) Recall the linked list implementation -------------------------------------- -------------- | ----- | v / | | head -> c -> h -> t nil <- tail the representative of the set = the first element in the list other elements may appear in any order in the list the node contains pointers to: -the next element -the representative Weighted-union heuristic: append the smaller list onto the longer, and break ties arbitrarily. Running time? ------------- We will analyze the running times of disjoint-set data structures in terms of two parameters: n = the of number MAKE-SET operations, and m = the total number of MAKE-SET, UNION, and FIND-SET operations Theorem 21.1: Using the linked-list representation of a disjoint set and the weighted-union heuristic, a sequence of m MAKE_SET, UNION, and FIND_SET, n of which are MAKE_SET, takes O(m + nlog n) time. MAKE_SET operations: -each operation takes \Theta(1) each -so n MAKE_SET operations take time \Theta(n) -since n >= m, n MAKE_SET operations take time O(m) UNION operations: -using the weighted-union heuristic, we always append the smaller list onto the larger one What is the upper bound on the number of times that an element's representative must be updated? Consider a fixed element x: -the first time x's representative is updated: x must have started in the smaller set, so the new set has at least two members -the second time x's representative is updated: x must have started in the smaller set, so the new set has at least four members -the kth time x's representative is updated, where k \leq n: x must have started in the smaller set, so the new set has at least 2^k members (Aside: They could prove this using induction.) Therefore, after x's representative pointer has been updated ...

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:

Toledo - CSC - 263
=CSC 263 Lecture Summary for Week 10 Fall 2007=[Q: denotes a question that you should think about and that will be answered during lecture. ]-Depth-First Search [ Section 22.3 ]- * Just like for BFS, ea
Allan Hancock College - TAA - 20064
Western Australia Taxi Amendment Act 2006 Western Australia Taxi Amendment Act 2006 CONTENTS Part 1 - Preliminary
Toledo - CSC - 263
=CSC 263 Lecture Summary for Week 5 Summer 2007=Problem 1: Read a text file, keeping track of the number of occurrences ofeach character (ASCII codes 0 - 127).Solution? A Direct-Address Table: simply keep track of
Toledo - CSC - 236
=CSC 236 Lecture Summary for Week 8 Fall 2007=Working on example: def pow(x, y): # function precondition: x in R, y in N z = 1 m = 0 # loop precondition: x in
Toledo - CSC - 236
=CSC 236 Lecture Summary for Week 5 Fall 2007=MergeSort(A,b,e): if b = e: return m = (b + e) / 2 MergeSort(A,b,m) MergeSort(A,m+1,e) # merge sorted A[b.m] and A[m+1.e] back into A[b.e] for i
Toledo - CSC - 236
=CSC 236 Lecture Summary for Week 4 Fall 2007=-Algorithm complexity-Refresher: - Measure running time by counting &quot;elementary steps&quot; in algorithm: arithmetic operations, assignments, array accesses, compa
Allan Hancock College - TAB - 2005161
Taxi Amendment Bill 2005 Explanatory MemorandumIntroductionUnder the present industry structure, the cost of plates and the cost of running aMulti-Purpose Taxi have made it economically tou
Toledo - CSC - 236
=CSC 236 Homework Assignment 3 Winter 2008=Due: by 10am on Thu 3 AprWorth: 8%For each question, please write your answer carefully. Keep in mind thatapproximately half of the marks for each question will b
Toledo - CSC - 236
=CSC 236 Lecture Summary for Week 2 Winter 2008=CONVENTION: Because we use induction almost always on natural numbers, I will omit &quot;(- N&quot; from all quantifiers from now on - so remember that for every quantifi
Toledo - CS - 104
CSC 104 Tutorial NotesBowen HuiJuly 06th 2005Recall from last time=- links - image - global vs. local - within document - emailIntroduction=- an HTML form is a section of a document - contains: regular HTML content controls-
Toledo - CS - 104
&lt;html&gt;this is a test page&lt;/html&gt;
Toledo - CSC - 236
=CSC 236 Sample Solutions for Week 9 Tutorial Fall 2007=This is the example in section 2.4 of the textbook, rephrased to use thesame notation I use in lecture.Prove the correctness of the following algorithm.Recall that
Toledo - CSC - 363
=CSC 363H Example of Turing machine description Fall 2007=We are going to define a TM that subtracts two numbers written in binary,as follows. - The input alphabet is {0,1,#} ('#' to separate the numbers). - If the input
Toledo - CSC - 363
=CSC 363H Exercise 4 Fall 2007=A. Show that there are countably many lists of 5 natural numbers. (Hint: For part of the answer, consider the sum of the numbers.)B. Show that there are uncounta
Toledo - CSC - 363
=CSC 363 Lecture Summary for Week 7 Fall 2008=Two last examples of &lt;=m. - EQ_TM is neither recognizable nor co-recognizable. (A language is &quot;co-recognizable&quot; if its complement is recognizable. Similar def
Toledo - CSC - 373
=CSC 373 Homework Assignment 2 - Marking Scheme Fall 2008=NOTE TO STUDENTS:You will find below the marking scheme used for your homework, includingthe meaning of marking codes and number of marks associated with each one.Th
Toledo - CSC - 373
=CSC 373 Lecture Summary for Week 1 Fall 2008=-Administrative information-Course Information Sheet.Please answer polls about office hours (on bulletin board) by this Friday!Motivation: - Abstraction is goo
Toledo - CSC - 373
=CSC 373 Homework Exercise 3 - Marking Scheme Fall 2008=NOTE TO STUDENTS:You will find below the marking scheme used for your homework, includingthe meaning of marking codes and number of marks associated with each one.Th
Toledo - ECONOMICS - 4060
Discussion of &quot;A Model of the Distribution of Talent Across Education Fields&quot;Written by Elena CapatinaModel Overview Uses a signaling model to analyze the sorting decisions of agents into education fields Agents develop all their skills at high
East Los Angeles College - GEOG - 5815
Geog5811M GIS in the Workplace Assessment 1Contributions to Discussion ThreadsIntroduction This course is assessed on two pieces of work. This first assessment is worth 10% of your module marks. Your task is to: post responses to at least 4 of t
East Los Angeles College - GEOG - 5891
Greater London Greater Manchester Merseyside South Yorkshire Tyne and Wear West Midlands West Yorkshire Avon Bedfordshire Berkshire Buckinghamshire Cambridgeshire Cheshire Cleveland Cornwall Cumbria Derbyshire Devon Dorset Durham
East Los Angeles College - GEOG - 2750
GEOG2750Earth Observation &amp; GIS of the Physical Environment20 Credit Level 2 Module Louise Mackay &amp; Steve Carver Module InformationSee also http:/www.geog.leeds.ac.uk/courses/level2/geog2750/index.htmlWeek 14 GEOG2750 Earth Observation &amp; GIS of
East Los Angeles College - GEOG - 2750
School of Geography University of Leeds GEOG27502004/2005 Level 2 Louise MackayPractical 7 and Assignment 4:Interpreting and explaining ERS2 SAR backscatter responseWeek 8Task: To use ERDAS Imagine to apply a speckle reduction filter to the E
Toledo - CSC - 2106
University of TorontoDepartment of Computer ScienceUniversity of TorontoDepartment of Computer ScienceLecture 9: Agreeing RequirementsValidating Requirements Validating Requirements Validation basics Validation basics Reviews and Inspections
Toledo - ECE - 461
Review of Important Networking ConceptsIntroductory material. This module uses the example from the previous module to review important networking concepts: protocol architecture, protocol layers, encapsulation, demultiplexing, network abstractions.
East Los Angeles College - TT - 0604
SCOUTO3 BALLOON/SONDES CAMPAIGN NIAMEY 26 JULY 26 AUGUST 2006J. P. Pommereau, A. Garnier and SCOUTO3 teamObjectives: Convective transport across tropopause associated to MCS Chemistry, dehydration, microphysics in TTLBalloonsFlight permissio
Toledo - UNI - 320
UNI320Y: Canadian Questions: Issues and DebatesWeek 9: Recognizing and Negotiating Citizenship Professor Emily Gilbert http:/individual.utoronto.ca/emilygilbert/ Recognizing and Negotiating Citizenship I.Limits to Multiculturalism Recogn
Toledo - UNI - 320
UNI320Y: Canadian Questions: Issues and DebatesWeek 2: Racializing CitizenshipProfessor Emily Gilbert http:/individual.utoronto.ca/emilygilbert/ Racializing CitizenshipI.Racism, Imperialism and Citizenship Citizenship as a Technology of
East Los Angeles College - LIB - 141
&lt;!DOCTYPE html PUBLIC &quot;-/W3C/DTD XHTML 1.0 Transitional/EN&quot; &quot;http:/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Cranfield CERES: Log In&lt;/title&gt; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;/&gt; &lt;script id
Toledo - UNI - 320
UNI320Y: Canadian Questions: Issues and DebatesWeek 4: Educating CitizensProfessor Emily Gilbert http:/individual.utoronto.ca/emilygilbert/ Educating CitizensI.Moral Reform in Early 20th Century Canada Schools, Education and Citizenship
Toledo - ACT - 348
ACT 348H1F, Advanced Life Contingencies, Fall 2008Lecture Section Lecture times, location InstructorL0101 M 3:00 p.m.-5:00 p.m. RW117 W 11:00 a.m.-12:00 p.m. RW117 Dr. Andrei Badescu, SS3105 tel: 416-946-7582 fax: 416-978-5133 badescu@utstat.to
East Los Angeles College - LIB - 1553
&lt;!DOCTYPE html PUBLIC &quot;-/W3C/DTD XHTML 1.0 Transitional/EN&quot; &quot;http:/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Cranfield CERES: Log In&lt;/title&gt; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;/&gt; &lt;script id
Laurentian - MGT - 3360
Chapter FourThe External Environment Thomson Learning 20044-1Relationship Between Environmental Characteristics and Organizational ActionsEnvironmentComplexity Uncertainty (Information) Stability Environmental SectorsOrganization Respon
Maple Springs - PSYC - 2120
Social Psychology-Lecture 4 Social Motivation Weiner's theory of social conduct Attitudes Tri-componential Separate Entities Attitude ChangeSocial Psychology-Lecture 3: Social Motivation Social Motivation: How we judge others and interact
East Los Angeles College - MUSI - 2923
MUSI2923Week 41MUSI 2923 The psychology of listening and performanceWeek 4: Infant perception and vocalisationModule Leader: Course Website: Aims To introduce you to research on early skills in music perception and vocalisation, and to provi
East Los Angeles College - MUSI - 2912
Case Study 2: Trehub, Bull and Thorpe (1984)MUSI 2912 Musical DevelopmentOverview Introduction: perceptual experiment with infants and children Theoretical background Methodologies Results for Trehub et al (1984) Experiments and observation
Laurentian - CPSC - 200303
Chapter 9: Sample ApplicationsOutline Spreadsheets Databases Numeric and Symbolic Computations Computer NetworksSocial Issues Applications Software Virtual Machine Hardware Algorithmic Foundations 1SpreadsheetsAn electronic
CSU Fullerton - IPC - 144
Lab 11 - IPC144 Introduction to Programming Using C Section _Name _ Student Number _+-+|Weekly Tip: When you are done writing to a file, remember to || close the file. Closing ensures that all data || gets to the devic
East Los Angeles College - GEOG - 5105
GEOG5105 CENSUS ANALYSIS AND GIS PRACTICAL EXERCISE 1 FINDING INFORMATION ON ACADEMIC AND OFFICIAL CENSUS WEB SITES Name: _ The purpose of this exercise is to introduce you to two important websites that provide access to the Area Statistics from the
East Los Angeles College - GEOG - 5105
Geog5105 Unit 9 Worksheet: Geographical Conversion IssuesName: _ Make notes for future reference. Email the completed worksheet to Prof Rees (p.rees@geog.leeds.ac.uk) and Christine Macdonald (c.macdonald@geog.leeds.ac.uk). Co
East Los Angeles College - GEOG - 5105
GEOG5105M Census Analysis and GIS Unit 2 The Census Data System: Procedures, Outputs and GeographyThe aims of this unit are to: provide an outline of the processes that are needed to produce census outputs describe the nature of those outputs d
Laurentian - MGT - 200603
Lecture Presentation Softwareto accompanyInvestment Analysis and Portfolio ManagementEighth Edition byFrank K. Reilly &amp; Keith C. BrownChapter 6Chapter 6 Efficient Capital MarketsQuestions to be answered: What is does it mean to say tha
East Los Angeles College - ACOM - 1900
AUTHOR(S)YEARTITLEJOURNAL/CONFERENCEAccot;Zhai2001Scale effects in steering law tasksProc. ACM CHIAcredolo1977Developmental Changes in the Ability to Coordinate Perspectives of a Large-Scale SpaceDevelopmental PsychologyAginsky;Harris;Ren
CSU Fullerton - BTP - 200
42. A. Teaching at Seneca is a union job, with union imposed limits on the amount of work a teacher may perform. The hours a teacher supposedly puts in are tallied to make sure that the limits are not exceeded. Code a
Sveriges lantbruksuniversitet - ECON - 19963
PROFILE OF STUDENTS IN SFU COURSES COURSE: ECON 301-5 ALL SECTIONS LOCATION: SFU TITLE: MICROECONOMIC THEORY SECTION TYPE: LEC SEMESTER: 1996-3 ENROL: 131
Allan Hancock College - ACOLS - 164
Cavity Enhanced Frequency Modulation SpectroscopyNicola van Leeuwen and Andrew WilsonUniversity of Otago Physics Department, PO Box 56, Dunedin, New Zealand Ph. +64 3 479 7789, Fax. +64 3 479 0964, Email. nicolav@physics.otago.ac.nzFrequency modu
Sveriges lantbruksuniversitet - HUM - 20011
Sheet1 PROFILE OF STUDENTS IN SFU COURSES COURSE: HUM 350-4 E01 TITLE: GREAT FIGURES SEMESTER: 2001-1 LOCATION: DOW SECTION TYPE: SEM ENROL: 17= PROGRAM OF STUDENT (Top 5 programs reported in each category Programs with &lt; 3 students not shown separ
East Los Angeles College - LIB - 1457
&lt;!DOCTYPE html PUBLIC &quot;-/W3C/DTD XHTML 1.0 Transitional/EN&quot; &quot;http:/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Cranfield CERES: Log In&lt;/title&gt; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;/&gt; &lt;script id
CSU Fullerton - SYS - 466
Domain Class Diagram:PurchaseOrder poNum poStatus 1 contains 1.npurchases product from 0.n 1Vendor vendorNum companyName companyPhone vendorEmail 1 sells 0.n Product prodNum qtyOnHandPOItem records purchase of qtyOrdered qtyRecvd 0.n 1Quest
CSU Fullerton - T - 3074
Linux version 2.6.17 (root@Knoppix) (gcc version 4.0.4 20060507 (prerelease) (Debian 4.0.3-3) #4 SMP PREEMPT Wed May 10 13:53:45 CEST 2006BIOS-provided physical RAM map: BIOS-e820: 0000000000000000 - 000000000009fc00 (usable) BIOS-e820: 0000000000
CSU Fullerton - OPS - 234
AS/400 Operations Navigator It is now possible for a user to execute AS/400 commands without having to learn Command Language syntax. Also, for those users who are aware of CL but feel more productive by pointing and clicking with a graphical interfa
CSU Fullerton - CTC - 203
Career Assessment1 It is logical that, if you do what you like to do and if enjoy the tasks involves, then you will be more energized and perform better. A first step is to take a good hard look at yourself, where you are, what's important to yo
CSU Fullerton - CTC - 206
Section 2 - PreparationPart 1- Self Assessment Part 2- Labour MarketPart 3 - Job Ad &amp; ResumePart 4 - Cover LetterSection 2 - PreparationPart 1 Self AssessmentYou will: Write self assessment test &amp; review results Relate skills to job area
Allan Hancock College - DAB - 2008183
1 Duties Amendment Bill 2008_Duties Amendment Bill 2008Explanatory NotesGeneral OutlinePolicy Objective of the BillsThe Bill seeks to amend the Duties Act 2001 to remove duties pai
Sveriges lantbruksuniversitet - ARTS - 20033
Sheet1 PROFILE OF STUDENTS IN SFU COURSES COURSE: WS 405-4 D01 LOCATION: SFU TITLE: THEORETICAL ISSUES SECTION TYPE: SEM SEMESTER: 2003-3 ENROL: 20 = PROGRAM OF STUDENT (Top 5 programs reported in each category Programs with &lt; 3 students not shown se
Sveriges lantbruksuniversitet - APSC - 19972
PROFILE OF STUDENTS IN SFU COURSES COURSE: CMNS 421-4 D01 LOCATION: SFU TITLE: ISSUES SEMINAR SECTION TYPE: SEM SEMESTER: 1997-2 ENROL: 18
East Los Angeles College - GEOG - 5081
Geog5081M GIS and Regional Planning Unit 7 NotesMobile GISThe aims of this unit are to: introduce mobile technologies and global positioning provide two case studies of mobile GIS that are relevant to planning.On completion of this unit you sh
East Los Angeles College - GEOG - 5195
Geog5191M Geodemographics and Database Marketing Unit 6 Notes Advanced Database Marketing TechniquesThe aims of this unit are to introduce you to the following techniques: data mining intelligent geodemographic targeting microsimulationOn compl
Toledo - JGP - 438
The textbook in general goes into more depth on each topic than we have in class, so it is difficult to identify exactly which parts of the text you have to know by section number alone. Here is my attempt. Section numbers are for the 2nd Edition of
Air Force Academy - STA - 575
April 8, 1997Mr. William WatsonEditorial Page EditorThe Ottawa Citizen1101 Baxter Road,Box 5020,Ottawa, OntarioK2C 3M4Dear Bill:Re:Catherine Ford Gun Control Column - April 7, 1997In her column
Allan Hancock College - TAR - 20091
EXPLANATORY STATEMENT Select Legislative Instrument 2009 No. 31Subject - Telecommunications Act 1997 Telecommunications Amendment Regulations 2009 (No. 1)Subsection 594(1) of the Telecommunications Act