my Algorithm code