algorithms to implement