Computing min and max using median of 3 elements
Let the list be $x_1,\ldots,x_n$. The algorithm is as follows:


Let $S = \{x_1,x_2\}$.
For $i = 3,\ldots, n$:


Add $x_i$ to $S$.
Compute the median of $S$, and remove it from $S$.

Output $S$.


I'll let you figure out why this works.

Note that we cannot possibly tell which is the minimum and which is the maximum. Indeed, $\operatorname{median3}$ works the same for both the original order and its reverse.