20. The sequence $1,2,3,4,5$ has $(\quad)$ different arrangements such that no three consecutive terms are in increasing or decreasing order.
(A) 10
(B) 18
(C) 24
(D) 32
(E) 44
20. D.

According to the problem, if the sequence cannot have three consecutive terms in a monotonic order, then the pattern of numbers from left to right would be one of the following two cases:

Large, Small, Large, Small, Large or Small, Large, Small, Large, Small.

For case 1, one of the second or fourth terms is 5, and the other is 3 or 4. We will discuss this by classification.
(1) $\_{ }^{3} \_{ }^{5} \_$.
In this case, the first and third terms must be $1$ and $2$, and the fifth term is 4, giving two possible arrangements.
(2) $\_$- ${ }^{3}$ _.
Similarly, there are two possible arrangements.
(3) $\_4 \_$. .
In this case, the first term can be $1$, $2$, or $3$, giving three possible choices, and the third term has two possible choices, resulting in 3! arrangements.
(4) _ 5 __ 4 .
Similarly, there are 3! arrangements.
Thus, $2!+2!+3!+3!=16$.
For case 2, there are also 16 possible arrangements.
Therefore, the total number of arrangements is $N=16+16=32$.