Implement some alogrithm with CPP