大家帮我看看求两个集合并集的算法?#include using namespace std;int main(void){double a[100],b[100],c[200];int l=0,g=0;cout

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/04 19:16:48
大家帮我看看求两个集合并集的算法?#include using namespace std;int main(void){double a[100],b[100],c[200];int l=0,g=0;cout

大家帮我看看求两个集合并集的算法?#include using namespace std;int main(void){double a[100],b[100],c[200];int l=0,g=0;cout
大家帮我看看求两个集合并集的算法?
#include
using namespace std;
int main(void)
{double a[100],b[100],c[200];
int l=0,g=0;
cout

大家帮我看看求两个集合并集的算法?#include using namespace std;int main(void){double a[100],b[100],c[200];int l=0,g=0;cout
不是演着你的思路,不过是挺好的一个算法,上算法课时候的练习,你可以看一下
/*----------------------------------------------
先对两个集合A,B排序,这样集合的运算会很方便
求A-B,A交B,A并B
----------------------------------------------*/
#include
#include
#include
using namespace std;
#define n 4
#define m 6
#define max 12
void sort(int c[],int num)
{
for(int i =0; i < num; i++)
{
int temp = c[i];
for (int j = i-1; j >= 0; j--)
{
if(c[j] > temp) c[j+1] = c[j];
else break;
}
c[j+1] = temp;
}
}
void print_array(int a[],int num)
{
for(int i = 0; i < num ;i++)
cout