rotate, search, and set algorithms