18 views

Uploaded by Gubbala Sandeep

save

- Week 3 - HW
- 1827.pdf
- Assembly Line Balancing
- B.sc Software Development 2017-2022
- 2
- Math
- Sec6.4
- Past HSC Inequalities Questions 2014
- mathf1t1
- Sequencing
- 2 Classes Relationship
- First Print Errata Rardin
- p
- Addison.wesley.the.Technical.and.Social.history.of.Software.engineering.dec.2013.ISBN.0321903420
- splane2.pdf
- Addmath Project
- code
- diff eq
- 10_5_16 Basic_Number_Theory.pdf
- Taller Java Studio Creator
- C Condensed Team
- Resume- Full Time
- Write Up Peru Camp 2015
- Notes on Counting
- Cognitive Effects Programming
- 08 Medians and Order Statistics
- Chap8
- NEU_Statement of Purpose
- Simulation Language.pdf
- Computer Science Curriculum Yeshiva
- Evolution of Atomic Structure.pdf
- Doc1
- Tan vs Comelec
- TITULOS VALORES
- klaskrant 5 ella en fee
- Ana Paula Becker PositivismoBrasil
- Mineralización singenetica de cobre.xlsx
- Ad Notam IR Protocol CCF DFU Up to 04-2013 Copy 2
- Sobre Sus Propiedades Medicinales Hay Que Decir Que Un Reciente Estudio Se Señaló Que Las Antocianinas Contenidas en El Pigmento Del
- Evolucionismo y La Teoria de Darwin
- DOM800 - 600374
- Creo que no a muchos se nos ha ocurrido preguntarnos.docx
- Cbr
- final submission - jasroop kaur aneja - dsjl - assignment 1
- Gambar Sik Arep Di Print
- edoc.site_laras-bahasa-agama.pdf
- Contraventii La Care Se Aplica Legea Prevenirii HG.33 2018
- Pasut Tp Apr2012
- P1 1st 1015 Solution 2
- União Ibérica - Aula
- Asombro Dio a Los Magos - SATB
- Resumo Oficina Literária
- REZUMAT_-_Teza_de_doctorat_-_K.Gabriella.pdf
- Lap.Blnan.Kematian.xls
- Schumann, Stuckchen
- Thivukottai Chola History
- KODE ICD
- Schedule
- List of NABL Labs in India

You are on page 1of 3

In computing given a set of elements, it is often useful to break them up or partition them into a number of separate, nonoverlapping sets. A disjoint-set data structure is a data structure that keeps track of such a partitioning. A union-find algorithm is an algorithm that performs two useful operations on such a data structure: Find: Determine in which set a particular element is in. Union: Combine or merge two sets into a single set. Because it supports these two operations, a disjoint-set data structure is sometimes called a union-find data structure or merge-find set. The other important operation, MakeSet, which makes a set containing only a given element (a singleton), is generally trivial. With these three operations, many practical partitioning problems can be solved . Disjoint-Set Linked Lists A simple approach to creating a disjoint-set data structure is to create a linked list for each set. The element at the head of each list is chosen as its representative. MakeSet creates a list of one element. Union appends the two lists, a constant-time operation. The drawback of this implementation is that Find requires Ω(n) or linear time. This can be avoided by including in each linked list node a pointer to the head of the list; then Find takes constant time. However, Union now has to update each element of the list being appended to make it point to the head of the new combined list, requiring Ω(n) time. Disjoint-Set Forests Disjoint-set forests are a data structure where each set is represented by a tree data structure, in which each node holds a reference to its parent node In a disjoint-set forest, the representative of each set is the root of that set's tree. Find follows parent nodes until it reaches the root. Union combines two trees into one by attaching the root of one to the root of the other. One way of implementing these might be: function MakeSet(x) x.parent := x

function Find(x) if x.parent == x return x else return Find(x.parent)

rank := 0 function Union(x. or Find operation Pseudocode for the improved MakeSet and Union: function MakeSet(x) x. Since it is the depth of the tree that affects the running time.rank yRoot.function Union(x.parent) .parent == x return x else x.rank yRoot. called union by rank. and whenever two trees of the same rank r are united.parent := xRoot else if xRoot != yRoot xRoot. The idea is that each node visited on the way to a root node may as well be attached directly to the root node. y) xRoot := Find(x) yRoot := Find(y) if xRoot. is a way of flattening the structure of the tree whenever Find is used on it.rank + 1 // Unless x and y are already in same set. One-element trees are defined to have a rank of zero.parent := yRoot if xRoot.rank > yRoot. The first way. called path compression.rank == yRoot. rather than vice versa. y) xRoot := Find(x) yRoot := Find(y) xRoot. merge them The second improvement.parent := yRoot however. Union. Just applying this technique alone yields an amortized running-time of O(logn) per MakeSet. is to always attach the smaller tree to the root of the larger tree. which only increases the depth if the depths were equal.parent := Find(x.rank := yRoot. it can be enhanced in two ways. function Find(x) if x. the rank of the result is r+1. the tree with smaller depth gets added under the root of the deeper tree.parent := x x. they all share the same representative.

The Union-Find algorithm is used in high-performance implementations of Unification. for example to keep track of the connected components of an undirected graph.parent Applications • • • • • Disjoint-set data structures model the partitioning of a set. This data structure is used by the Boost Graph Library to implement its Incremental Connected Components functionality. It is also used for implementing Kruskal's algorithm to find the minimum spanning tree of a graph . or whether adding an edge between them would result in a cycle. This model can then be used to determine whether two vertices belong to the same component.return x.

- Week 3 - HWUploaded bymisterreid
- 1827.pdfUploaded bysrinjoy chakravorty
- Assembly Line BalancingUploaded byHarshad_S
- B.sc Software Development 2017-2022Uploaded byAnonymous W9BU8Fo
- 2Uploaded bypriyaniruma
- MathUploaded byBezalel Ilagan
- Sec6.4Uploaded byTheGreatPostulio
- Past HSC Inequalities Questions 2014Uploaded byamelia
- mathf1t1Uploaded byngireneain
- SequencingUploaded bySundaramali Govindaswamy G
- 2 Classes RelationshipUploaded byemygun
- First Print Errata RardinUploaded byMarcelo Ziulkoski
- pUploaded byapi-303041732
- Addison.wesley.the.Technical.and.Social.history.of.Software.engineering.dec.2013.ISBN.0321903420Uploaded byJCortesM
- splane2.pdfUploaded byMohd Amri N Asmah
- Addmath ProjectUploaded byIntan Julia Azman
- codeUploaded byapi-3755266
- diff eqUploaded byTin Montoya
- 10_5_16 Basic_Number_Theory.pdfUploaded byaoiwefowei
- Taller Java Studio CreatorUploaded byapi-3735749
- C Condensed TeamUploaded bylusienopop
- Resume- Full TimeUploaded bybala_subu7
- Write Up Peru Camp 2015Uploaded byMarcoFrancisco
- Notes on CountingUploaded byNurlia Ningsih
- Cognitive Effects ProgrammingUploaded byLiz Aliza
- 08 Medians and Order StatisticsUploaded byZemal Malik
- Chap8Uploaded bytejashraj93
- NEU_Statement of PurposeUploaded byAkash Warade
- Simulation Language.pdfUploaded byhmsohag
- Computer Science Curriculum YeshivaUploaded byD