Algorithms for finding best locations of cluster heads for minimizing energy consumption in wireless sensor networks