Adding first version of naive algorithm