Human memory as a sequence of recursive algorithms