finish kth smallest code and add a test for utils