A root-finding algorithm based on Newton's method