ADS
Algorithms and Data Structures
Toggle main menu visibility
Loading...
Searching...
No Matches
ListMFSet.h
Go to the documentation of this file.
1
/*--------------------------------------------------------------------------*/
2
/*---------------------------- File ListMFSet.h ----------------------------*/
3
/*--------------------------------------------------------------------------*/
26
/*--------------------------------------------------------------------------*/
27
/*----------------------------- DEFINITIONS --------------------------------*/
28
/*--------------------------------------------------------------------------*/
29
30
#ifndef __ADS_ListMFSet
31
#define __ADS_ListMFSet
32
/* self-identification: #endif constant */
33
34
/*--------------------------------------------------------------------------*/
35
/*------------------------------ INCLUDES ----------------------------------*/
36
/*--------------------------------------------------------------------------*/
37
38
#include "
ADS/Contract.h
"
39
40
#include <stdexcept>
41
#include <utility>
42
#include <vector>
43
44
/*--------------------------------------------------------------------------*/
45
/*--------------------------- NAMESPACE ------------------------------------*/
46
/*--------------------------------------------------------------------------*/
47
48
namespace
ADS
49
{
50
51
/*--------------------------------------------------------------------------*/
52
/*---------------------------- CLASS ListMFSet -----------------------------*/
53
/*--------------------------------------------------------------------------*/
54
57
class
ListMFSet
58
{
59
60
/*--------------------------------------------------------------------------*/
61
public
:
64
explicit
ListMFSet
(
int
n
);
65
67
[[nodiscard]]
int
n
(
void
)
const
;
68
71
[[nodiscard]]
int
find
(
int
x )
const
;
72
93
bool
merge
(
int
x ,
int
y );
94
96
[[nodiscard]]
long
relabels
(
void
)
const
;
97
98
/*------------------------- THE STANDARD INTERFACE -------------------------*/
99
102
[[nodiscard]]
const
std::vector< int > &
members
(
int
x )
const
;
103
104
/*--------------------------------------------------------------------------*/
105
private
:
107
[[nodiscard]]
bool
listed(
void
)
const
;
108
109
std::vector< int > f_head;
110
std::vector< std::vector< int > > f_list;
111
long
f_relabels = 0;
112
113
};
// end( class ListMFSet )
114
115
}
// end( namespace ADS )
116
117
/*--------------------------------------------------------------------------*/
118
/*-------------------------- IMPLEMENTATION --------------------------------*/
119
/*--------------------------------------------------------------------------*/
120
121
#include "ADS/mfset/impl/ListMFSet.tpp"
122
123
/*--------------------------------------------------------------------------*/
124
125
#endif
/* ListMFSet.h included */
126
127
/*--------------------------------------------------------------------------*/
128
/*-------------------------- End File ListMFSet.h --------------------------*/
129
/*--------------------------------------------------------------------------*/
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
ADS::ListMFSet::members
const std::vector< int > & members(int x) const
the members of the set of
ADS::ListMFSet::find
int find(int x) const
the head of the list of , in time
ADS::ListMFSet::n
int n(void) const
the number of elements
ADS::ListMFSet::ListMFSet
ListMFSet(int n)
the singletons
ADS::ListMFSet::merge
bool merge(int x, int y)
joins the lists of and , the shorter after the longer, its elements relabeled; true if they were dis...
ADS::ListMFSet::relabels
long relabels(void) const
the elements relabeled so far
ADS
Definition
ADT.h:96
ADS
mfset
ListMFSet.h
Generated by
1.17.0