-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset.h
More file actions
68 lines (45 loc) · 1.48 KB
/
set.h
File metadata and controls
68 lines (45 loc) · 1.48 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* File: set.h
* - header file for datatype set
*
* Author: Hermann Stamm-Wilbrandt
* Institut fuer Informatik III
* Roemerstr. 164
* Bonn University
* D-53117 Bonn
* Germany
* email: hermann@holmium.informatik.uni-bonn.de
* phone: 0228-550-260 internal: x260 or x28, Fax: 0228-550-382
*
* For my safety:
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef def_set_h
#include "array.h"
extern num set_aux;
typedef num *set_of_num;
typedef num iterator;
#define _forall_items(it,S) for( (it) = _first(S); (it); (it) = _succ(it,S))
#define _forall(x,S) for(set_aux=_first(S); \
x=set_aux?S[set_aux]:x,set_aux; \
set_aux=_succ(set_aux,S))
#define _forall_rev(x,S) for(set_aux=_last(S); \
x=set_aux?S[set_aux]:x,set_aux; \
set_aux=_pred(set_aux,S))
set_of_num new_set(num k);
void delete_set(set_of_num S);
num _size(set_of_num S);
bool _empty(set_of_num S);
iterator _first(set_of_num S);
iterator _last(set_of_num S);
iterator _succ(iterator it, set_of_num S);
iterator _pred(iterator it, set_of_num S);
bool _search(num x, set_of_num S);
bool _duplicates(set_of_num S);
void _append(num x, set_of_num S);
void _bucket_sort(num low, num high, array_of_num Map, set_of_num S);
#define def_set_h
#endif