completed algorithm implemenation witn an example of weather dataset