Notice
Recent Posts
Recent Comments
Link
목록2024/10/15 (1)
HJW's IT Blog
[프로그래머스 / JAVA / Javascript] 표병합
UnionFind란?Union Find 란 집합의 원소들이 어느 그룹에 속해 있는지를 빠르게 찾고 (Find) , 합치는 (Union) 연산을 효율적으로 처리하도록 설계된 자료구조이다.주로 서로소 집합(Disjoint Set) 문제를 해결되는데 사용되는데, 서로소 집합이란 공통된 원소가 없는 두 집합을 의미한다.기본 연산Union Find 는 이전에 말했듯이, Find 와 Union 연산을 지원해야 한다.Find : 주어진 원소가 속한 대표 를 찾는 연산이다.int[] find(int x, int y){ int[] root = this.parents[x][y]; if(root[0] == x && root[1] == y) return new int[]{x,y}; int..
Algorithm
2024. 10. 15. 15:01