Algorithm Part III

Find the enter and leaving varaibles