my algorithm code