Assume you have written a hill climbing algorithm which is very slow. Your smallest data unit is a Node. You have another class called NodeList which contains a list of Nodes plus some other data. You have a list of NodeLists, and their number or order doesn’t change. Your algorithm is trying to decide which Node should go in which NodeList, so that we end up with the best score. After profiling the algorithm, you find out the score calculation is consuming 95% of the CPU time. Can you think of general ways to speed up the algorithm?
I have tried to google it and learn about the basic concept of hill climbing algorithm. But still can't figure out what should I do to improve the algorithm. Any help will be appreciated. Thanks.