[Cs3] list reverse

Mikhail Nesterenko mikhail at cs.kent.edu
Wed Sep 20 14:26:23 EDT 2017


This is regarding the constant-time implementation of the
list.reverse() function. The standard requires only linear time
implementation.

A constant-time reversible implementation of a double linked list is
possible. However, the iterators over such reversible list need to know
which direction (up or down) is the right one. Which requires an extra
lookup. List reversion is a relatively infrequent operation compared
to iteration, so standards optimization is toward iteration.

Thanks,
-- 
Mikhail


More information about the cs3 mailing list