search and sorting algorithms with C++