Created
April 10, 2019 10:32
-
-
Save HassanElDesouky/d48ed90ac9ecfcd11e4e9bed9f024659 to your computer and use it in GitHub Desktop.
DSU article
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by Hassan El Desouky on 2019-04-01. | |
// | |
#ifndef PST_DSU_H | |
#define PST_DSU_H | |
class DSU { | |
public: | |
DSU(int n); | |
void union_sets(int u, int v); | |
bool same_set(int u, int v); | |
~DSU(); | |
private: | |
int find_parent(int u); | |
void swap(int& a, int& b); | |
int* parent; | |
int* sz; | |
}; | |
#endif //PST_DSU_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment