Class ListMFSet

Class Documentation

class ListMFSet

the union of disjoint sets on lists, each element with the head of its list

Public Functions

explicit ListMFSet(int n)
Pre:

n >= 0

int n(void) const
int find(int x) const

O( 1 ) time.

Pre:

x in [ 0 , n )

bool merge(int x, int y)

the shorter list goes after the longer one, its elements relabeled

Pre:

x , y in [ 0 , n )

Post:

x and y have the same head

long relabels(void) const

the elements relabeled so far

const std::vector<int> &members(int x) const

the members of the set of x

Pre:

x is in [ 0 , n )