algorithm length vs naive time