×

# connecting islands

 0 can anyone please tell me which theorem is to be applied in connecting islands?? asked 05 Feb '15, 23:29 2★vip_code 1 accept rate: 0%

 0 The question is basically asking if two vertices belong to the same connected component( edges are added dynamically here though). Union-Find Disjoint data structure can be used to solve this problem. For each edge to be added between x any y, take the Union of set(x) and set(y) . For checking if vertices x and y are connected or not, see if they both belong to the same set. answered 05 Feb '15, 23:50 333●2●3●9 accept rate: 20%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

question asked: 05 Feb '15, 23:29

question was seen: 513 times

last updated: 05 Feb '15, 23:50