linear time find_smallest