In this answer I will provide you with the main hints that can help you to write a compare&contrast essay on your own.
1) How the ideas of Descartes and Locke were similar? Their common subject of philosophical studying was to get to know what the real knowledge was. Both of them focused on this question, trying to find out whether the mind and body took part in obtaining of knowledge.
2) How did their ideas differ? First of all, Descartes was a rationalist, which means that he thought that knowledge of the world could be achieved by exercise of reason. As an empiricist, Locke believed that such knowledge could only be gained through the senses.