#include <iostream>
#include <algorithm>
Go to the source code of this file.
|
| void | remove_duplicates_ (int *array, int *size, int *new_size) |
| void _FCALL | union_2_sorted_sets_ (int *array1, int *array1_size, int *array2, int *array2_size, int *result, int *result_size) |
| void _FCALL | intersect_2_sorted_sets_ (int *array1, int *array1_size, int *array2, int *array2_size, int *result, int *result_size) |
| void _FCALL | difference_2_sorted_sets_ (int *array1, int *array1_size, int *array2, int *array2_size, int *result, int *result_size) |
| void _FCALL | count_member_list_ (int *union_list, int *size_union_list, int *merged_list, int *size_merged_list, int *number_appearance, int *proc_id) |
◆ _FCALL
◆ count_member_list_()
| void _FCALL count_member_list_ |
( |
int * | union_list, |
|
|
int * | size_union_list, |
|
|
int * | merged_list, |
|
|
int * | size_merged_list, |
|
|
int * | number_appearance, |
|
|
int * | proc_id ) |
Definition at line 155 of file set_tools.cpp.
158 {
159 int max_number_appearance = 0 ;
160 for(int i=0; i<*size_union_list ; i++)
161 {
162 int my_value = union_list[i] ;
163 int mycount = std::count ( merged_list, merged_list+ *size_merged_list, my_value);
164 number_appearance[i] = mycount ;
165 if(max_number_appearance<mycount)
166 {
168 max_number_appearance = mycount;
169 }
170 }
171 }
◆ difference_2_sorted_sets_()
| void _FCALL difference_2_sorted_sets_ |
( |
int * | array1, |
|
|
int * | array1_size, |
|
|
int * | array2, |
|
|
int * | array2_size, |
|
|
int * | result, |
|
|
int * | result_size ) |
Definition at line 134 of file set_tools.cpp.
137 {
138
139 int *fin = set_difference(array1, array1+*array1_size,
140 array2, array2+*array2_size,
141 result);
142
143 *result_size = fin-result;
144 }
◆ intersect_2_sorted_sets_()
| void _FCALL intersect_2_sorted_sets_ |
( |
int * | array1, |
|
|
int * | array1_size, |
|
|
int * | array2, |
|
|
int * | array2_size, |
|
|
int * | result, |
|
|
int * | result_size ) |
Definition at line 109 of file set_tools.cpp.
112 {
113
114 int *fin = set_intersection(array1, array1+*array1_size,
115 array2, array2+*array2_size,
116 result);
117
118 *result_size = fin-result;
119 }
◆ remove_duplicates_()
| void remove_duplicates_ |
( |
int * | array, |
|
|
int * | size, |
|
|
int * | new_size ) |
Definition at line 51 of file set_tools.cpp.
52 {
53 if ( * size == 0){
54 *new_size=0;
55 return;
56 }
57 int sz=1 ;
58 int i=1;
59
60 while (i< *size) {
61 if ( array[i-1] != array[i]) {
62 array[sz] = array[i];
63 sz++;
64 }
65 i++;
66 }
67
68 *new_size = sz;
69 return;
70 }
◆ union_2_sorted_sets_()
| void _FCALL union_2_sorted_sets_ |
( |
int * | array1, |
|
|
int * | array1_size, |
|
|
int * | array2, |
|
|
int * | array2_size, |
|
|
int * | result, |
|
|
int * | result_size ) |
Definition at line 84 of file set_tools.cpp.
87 {
88
89 int *fin = set_union(array1, array1+*array1_size,
90 array2, array2+*array2_size,
91 result);
92
93 *result_size = fin-result;
94 }