Express the union, intersection and product of a venn diagram of two circles using Psuedocode

Assume we have a Venn diagram of two circles. We have to find the union, intersection and the product of them. For example, we have the sets:

A={a,b,f,g} and B={b,e,f,h}

Union AUB={a,b,e,f,g,h}

Intersection A∩B={f,g}

Product A⋅B={ab,ae,af,ah,bb,be,bf,bh,fb,fe,ff,fh,gb,ge,gf,gh}

My question is, how do we write these operations in Pseudocode? I don’t know how to do it. Any help is appreciated. Thank you.

Forget pseudo-code for the moment. What is your process of determining the union of AUB if you were asked to do it manually (i.e. on paper)? What is your thought process? That thought process is the algorithm. Once you have the algorithm, then it is fairly simple to turn it into code (in any language).

Once you figure out the union, then you repeat the above process for intersection and product.