[CSI] complexity of clear()

Mikhail Nesterenko mikhail at cs.kent.edu
Tue Feb 8 16:13:46 EST 2022


CS3 students,

The standard says that complexity of clear() is actually linear for
both vectors and deques because clear() has to invoke destructors on
every element that is being destroyed.

However, some implementations provide constant complexity for built-in
types.
-- 
Mikhail


More information about the cs13001 mailing list