5. Suppose ten people each carry a bucket to a water tap to fill it. Let the time required for the water tap to fill the bucket of the $i$-th person $(i=1,2, \cdots, 10)$ be $T_{i}$ minutes, assuming these $T_{i}$ are all different. Ask:
（1）When only one water tap is available, how should the order of these ten people be arranged to minimize their total waiting time (including the time each person spends filling their own bucket)? What is this time? (You must prove your argument)
（2）When two water taps are available, how should the order of these ten people be arranged to minimize their total waiting time? What is this time? (You must prove your argument)
(1) When the $i$-th person is getting water, there are $11-i$ people waiting, so when only one water tap is available, their total waiting time is $S=10 T_{1}+9 T_{2}+\cdots+T_{10}$.
If $iT_{j}$, then the total waiting time before and after adjusting the order of these two people is
$S=10 T_{1}+\cdots+(11-i) T_{i}+\cdots+(11-j) T_{j}+\cdots+T_{10}$,
$S^{\prime}=10 T_{1}+\cdots+(11-i) T_{j}+\cdots+(11-j) T_{i}+\cdots+T_{10}$.
Thus, $S^{\prime}-S=(11-i)\left(T_{j}-T_{i}\right)+(11-j)\left(T_{i}-T_{j}\right)=(j-i)\left(T_{j}-T_{i}\right)<0$, which indicates that the total waiting time decreases after the adjustment. Therefore, the person with the shorter water-filling time should get water first, which minimizes the total waiting time for ten people. Assume $T_{1}<T_{2}<\cdots<T_{10}$,
so we have $S_{\min }=10 T_{1}+9 T_{2}+\cdots+T_{10}$.
(2) First, prove that the total waiting time is minimized when exactly 5 people get water from each tap.
Assume that 6 people get water from tap $A$, with corresponding times $T_{1}^{\prime}<T_{2}^{\prime}<\cdots<T_{6}^{\prime}$, and 4 people get water from tap $B$, with corresponding times $T_{7}^{\prime}<T_{8}^{\prime}<T_{9}^{\prime}<T_{10}^{\prime}$. From (1), the total waiting time is $S=6 T_{1}^{\prime}+5 T_{2}^{\prime}+4\left(T_{3}^{\prime}+T_{7}^{\prime}\right)+3\left(T_{4}^{\prime}+T_{8}^{\prime}\right)+2\left(T_{5}^{\prime}+T_{9}^{\prime}\right)+T_{6}^{\prime}+T_{10}^{\prime}$. At this point, if $T_{2}^{\prime}$ is adjusted to get water from tap $B$, the total waiting time is at most
$$
S_{1}=5\left(T_{1}^{\prime}+T_{2}^{\prime}\right)+4\left(T_{3}^{\prime}+T_{7}^{\prime}\right)+3\left(T_{4}^{\prime}+T_{8}^{\prime}\right)+2\left(T_{5}^{\prime}+T_{9}^{\prime}\right)+T_{6}^{\prime}+T_{10}^{\prime} .
$$

Since $S_{1}-S=-T_{1}^{\prime}<0$, it indicates that the total waiting time decreases after the adjustment.
Thus, when two water taps are available, if tap $A$ arranges the $i_{1}, i_{2}, i_{3}, i_{4}, i_{5}$-th people to get water, and tap $B$ arranges the $j_{1}, j_{2}, j_{3}, j_{4}, j_{5}$-th people to get water, the total waiting time is
$$
\begin{array}{l}
S=5\left(T_{i 1}+T_{j 1}\right)+4\left(T_{i 2}+T_{j 2}\right)+\cdots+\left(T_{i 5}+T_{j 5}\right) \\
\geqslant 5\left(T_{1}+T_{2}\right)+4\left(T_{3}+T_{4}\right)+3\left(T_{5}+T_{6}\right)+2\left(T_{7}+T_{8}\right)+\left(T_{9}+T_{10}\right) .
\end{array}
$$

Therefore, by arranging each pair of people from $\{1,2\},\{3,4\},\{5,6\},\{7,8\},\{9,10\}$ to get water from the two taps, the total waiting time is minimized, and
$$
S_{\min }=5\left(T_{1}+T_{2}\right)+4\left(T_{3}+T_{4}\right)+3\left(T_{5}+T_{6}\right)+2\left(T_{7}+T_{8}\right)+\left(T_{9}+T_{10}\right) .
$$