Implement sort method
add new test case for search method