Minor improvements, Fixed CPT algorithm

Side note: putIfAbsent is not a hashmap method