# Set - Difference

### Table of Contents

## About

## Articles Related

## Type

### Asymmetric

In a asymmetric difference, the difference element come only from the first set.

The asymmetric difference | ||||||
---|---|---|---|---|---|---|

of | 1 | 2 | 3 | 4 | ||

and | 3 | 4 | 5 | 6 | ||

is | 1 | 2 |

Implementation:

- loop over setA
- does setB has element of setA
- if yes, return the element

### Symmetric

The symmetric difference is the union of the two asymmetric difference

- asymmetric diff SetA to SetB
- asymmetric diff SetB to SetA

The symmetric difference | ||||||
---|---|---|---|---|---|---|

of | 1 | 2 | 3 | 4 | ||

and | 3 | 4 | 5 | 6 | ||

is | 1 | 2 | 5 | 6 |