code for testing operation on sorted sets