Implement square-root finding algorithm