algorithm for racket