code for the algorithms used in thesis