used for learning algorithms, following Introduction to Algorithms 3rd edition