PyAlgo-Tree icon indicating copy to clipboard operation
PyAlgo-Tree copied to clipboard

UnionFind/Disjoint Set

Open TheDoctor561 opened this issue 3 years ago β€’ 2 comments


Title: Union Find Directory: Graph Name: Daniel Yu-cua


Define You:

  • [x] Hacktoberfest2022 Participant
  • [x] Contributor

Problem

Write to program in Python to implement a Disjoint set also known as Union Find. A disjoint set is a data structure that stores a collection of "disjoint" (non-overlapping) sets. This data structure is useful to determine whether two vertices of a graph belong to the same component, or whether an edge between them would result in a cycle. It is a key component in implementing Kruskal's algorithm to find the minimum spanning tree.

Type of change

What sort of change have you made:

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [x] Code style update (formatting, local variables)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

Input:

UnionFind(5)
union(1,2)
union(4,5) 
isConnected(1,2)
isConnected(3,4) 

Output:

1 2 3 4 5 
1-2 3 4 5 
1-2 3 4-5
True
False

@prathimacode-hub Please assign me this issue, I'll be contributing as a Hacktoberfest 2022 participant.

TheDoctor561 avatar Oct 03 '22 14:10 TheDoctor561

Hello there! πŸ‘‹πŸ» Welcome to the PyAlgo-Tree! πŸš€βš‘οΈ Thank you and congrats πŸŽ‰ for opening your very first issue in this project. Please adhere to our Code of Conduct. πŸ‘πŸ» You may submit a PR if you like, make sure to follow our Pull Request Template. Feel free to get in touch with me through social media handles. Hope to see you there!πŸ˜„

welcome[bot] avatar Oct 03 '22 14:10 welcome[bot]

Issue assigned to @TheDoctor561

prathimacode-hub avatar Oct 03 '22 14:10 prathimacode-hub