  A conflict-avoiding code (CAC) is a deterministic transmission scheme for
asynchronous multiple access without feedback. When the number of
simultaneously active users is less than or equal to $w$, a CAC of length $L$
with weight $w$ can provide a hard guarantee that each active user has at least
one successful transmission within every consecutive $L$ slots. In this paper,
we generalize some previously known constructions of constant-weight CACs, and
then derive several classes of optimal CACs by the help of Kneser's Theorem and
some techniques in Additive Combinatorics. Another spotlight of this paper is
to relax the identical-weight constraint in prior studies to study mixed-weight
CACs for the first time, for the purpose of increasing the throughput and
reducing the access delay of some potential users with higher priority. As
applications of those obtained optimal CACs, we derive some classes of optimal
mixed-weight CACs.
