How about trying something yourself first. Post questions related to your attempts at a solution instead of just pasting part of your homework/exam question here.
If you do a little work looking at some of
these links, you will gain a much better understanding of what you are trying to learn.