Disjoint Set Data Structure Problems

Revision en2, by utkarsh_108, 2024-04-04 22:41:31

The below article is an attempt to create a good starting point for people who practice some good DSU problems

you read the Nice blog by kartik8800 DSU Blog here you tell basics to advanced about DSU

below code is written by striver you can take reference from his YT channel TAKE U FORWARD

striver_79

standard DSU


#### PROBLEM 1

1 -> This Problem Based how we can use DSU beautifully by sorting the edges of the graph

1213G - Path Queries

Hint 1
Hint 2
DSU code

Check my submission


#### PROBLEM 2

2 -> This Problem is easy side of DSU to make the network connected

25D - Roads not only in Berland

Hint 1
DSU code

Check my submission


#### PROBLEM 3

3 -> you have to make forest by adding edges by making two DSU

1559D1 - Mocha and Diana (Easy Version)

Hint 1
DSU code

Check my submission


#### PROBLEM 4

4 -> This Problem Based how we can minimise the or of the no by making highest bit to Zero

1624G - MinOr Tree

Hint 1
DSU code

Check my submission


#### PROBLEM 5

5 -> This Problem Based how we can use DSU to connect the edges from edge weight form low to high

1468J - Road Reform

Hint 1
DSU code

Check my submission

this is good level 5 problem enough to Grasp the concepts if you want to try more prblem try this Codeforces DSU Problems

ALL THE BEST FOR YOUR CODING JOURNEY :)

Tags dsu, disjoint set union, disjoint set, disjoint union, graph, problem

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English utkarsh_108 2024-04-04 22:41:31 15 Tiny change: ' to high\n[problem' -> ' to high\n\n\n[problem'
en1 English utkarsh_108 2024-04-04 20:45:37 5450 Initial revision (published)