I want to write an algorithm for determining the truth value of: "for all $x \in D$, $\exists y \in E$ such that $x$ and $y$ satisfy $P(x,y)$"
and
"$\exists x \in D$ such that $\forall y \in E$, $x$ and $y$ satisfy $P(x,y)$"
in pseudo-code, for generic D, E, P(x,y), for the benefit of computer science students' understanding.
You first need an interpretation of the predicates $D$, $E$ and $P$ in some structure $\mathcal{M}$.
My answer assumes that :
The function satisfies_formula1 bellow will return True if the formula $\forall x \in D, \ \exists y \in E, \ P(x,y)$ holds, false otherwise. The function satisfies_formula2 does the same for the formula $\exists x \in D, \ \forall y \in E, \ P(x,y)$.