Preview

Student

Good Essays
Open Document
Open Document
1224 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Student
OLYMPIC TIN HỌC HUFLIT 2014

BÀI 11 (NC)

UNION-FIND DISJOINT SETS
THEORY
In computing, a disjoint-set data structure, also called a union–find data structure or merge–find set, is a data structure that keeps track of a set of elements partitioned into a number of disjoint
(nonoverlapping) subsets. It supports two useful operations: o Find: Determine which subset a particular element is in. Find typically returns an item from this set that serves as its "representative"; by comparing the result of two Find operations, one can determine whether two elements are in the same subset. o Union: Join two subsets into a single subset.
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 (see the Applications section).
In order to define these operations more precisely, some way of representing the sets is needed. One common approach is to select a fixed element of each set, called its representative, to represent the set as a whole. Then, Find(x) returns the representative of the set that x belongs to, and Union takes two set representatives as its arguments.
Figure 1 shows a union-find disjoint sets:

Minh họa: http://www.comp.nus.edu.sg/~stevenha/visualization/ufds.html
Tài liệu tham khảo: Sách Steven Haslim Phần Union-Find Disjoint Sets
Vấn đề: Sinh viên hãy tham khảo tài liệu của Robert Segwick và Steven Haslim để cài đặt cấu trúc dữ liệu Union-Find Disjoint Sets
Figure 2 shows a Disjoint-sets forest with "union by rank" and "pass compression" heuristics:

GVHD: ĐỖ NHƯ TÀI

Trang 1 / 5

OLYMPIC TIN HỌC HUFLIT 2014

BÀI 11 (NC)

http://just-developer.livejournal.com/97353.html
GVHD: ĐỖ NHƯ TÀI

Trang 2 / 5

OLYMPIC TIN HỌC HUFLIT 2014

BÀI 11 (NC)

PHẦN 2. BÀI TẬP ỨNG DỤNG
EXERCISE 1. UVa 00793 - NETWORK CONNECTIONS
Bob, who is a network administrator, supervises a

You May Also Find These Documents Helpful

Related Topics