solving exercises for some cormen tasks