Since AB is a diameter, we know that angle AEB is a right angle. Since CD is perpendicular to AB, angle CDE is also a right angle. Thus, we have a right triangle CDE with hypotenuse CD and legs CE and DE.
Since AE = 16 and EB = 4, we have AB = AE + EB = 16 + 4 = 20. Since AB is a diameter, its length is the same as CD. Thus, CD = 20.
Using the Pythagorean theorem in triangle CDE, we have:
CE^2 + DE^2 = CD^2
CE^2 + (CE + 4)^2 = 20^2
2CE^2 + 8CE - 144 = 0
CE^2 + 4CE - 72 = 0
(CE + 9)(CE - 8) = 0
Since CE cannot be negative, we have CE = 8. Thus, DE = 12.
Therefore, CD = AB = 20.