Sometimes you need a small algorithm for a game, for instance a test if a point is inside or outside a triangle defined by three other points.
You can make and test your own solution which will certainly be very instructive, but other very dedicated people have come up with clever solutions and these are very tested!
a good link is: http://www.gmlscripts.com/
for instance, for the problem mentioned above you type triangle in the search field and it comes up with the solution in a readable format:
it is easily translated in c for our nds purposes!