add gitignore
added second part of the algorithm