Finding the pseudo-code of an algorithm that tests if a function is antisymmetric

189 Views Asked by At

I am searching for a way to write a pseudocode for a algorithm that can determine if a relation $R$ (on a (finite) set $X$) is antisymmetric.

Now I was thinking that I might try to make a function that tests all the conditions (required by a relation in order to be antisymmetric) for all pairs in the set $X$.

Now the issue here is that I don't seem to be able to make such a function. Can someone make it or guide me towards it? Do you have any examples of similar pseudocode? Your help will be really appreciated. Thanks!

1

There are 1 best solutions below

0
On

Just do as you say: check all relevant pairs. I.e., pick each $x$ in turn, for all $y$ check if the condition(s) hold for $x, y$. If you find a pair that doesn't check out, bail out early answering "no"; if you run out of pairs to check, answer "yes".

You might streamline this somewhat, depending on the exact properties of the conditions.