implemented SELECT(selecting ith smallest element from set A.