Fixed and simplified the 4 existing algorithms

Created a working unittest for exhaustive search