Put table into shared_ptr in nearest_neighbor driver and algorithms