code (add my understanding) of 《Algorithms》Fourth Edition