here is the exercise for stanford open course- introduction to algorithm