by adding the comparators how can we search on normal integer,character array or vectors
Search on normal integer arrays
Hello @mohitsingh in custom comparator fucntion you write the condition on the basis of which you want to sort or arrange the elements in the data structure :
like suppose if you want to sort the array in the descending order then in the custom function you will do like this:
bool compare(int a,int b){
return a>b;//your logic here:}
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.