Skip to content

Instantly share code, notes, and snippets.

@HassanElDesouky
Created April 10, 2019 10:32
Show Gist options
  • Save HassanElDesouky/d48ed90ac9ecfcd11e4e9bed9f024659 to your computer and use it in GitHub Desktop.
Save HassanElDesouky/d48ed90ac9ecfcd11e4e9bed9f024659 to your computer and use it in GitHub Desktop.
DSU article
//
// 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