two sample algorithm