CLRS implementation.