-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisjointSets.h
More file actions
51 lines (35 loc) · 871 Bytes
/
disjointSets.h
File metadata and controls
51 lines (35 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef disjointsets_h
#define disjointsets_h
#include <iostream>
#include <vector>
#include "stack.h"
using namespace std;
class disjointSet :public List<int>
{
public:
disjointSet(int nodes);
~disjointSet();
int at(int pos);
int find(int target, int iterations = 0);
int findRoot();
bool findLoop();
bool findLoop(int root, int child, int uniontype = 0);
vector<int>* linked(int node);
int pointedAt(int target);
void printSet(int target);
stack<int>* toStack(int target, stack<int>* newStack);
int setAt(int target);
bool setUnion(int root, int child, int uniontype = 0);
int connected();
bool connected(int randInt, int genInt);
bool complete(int ID);
int unionCount();
private:
bool basicUnion(int a, int b);
bool sizeUnion(int a, int b);
bool heightUnion(int a, int b);
vector<int>* setVector;
int Vnodes;
int count;
};
#endif