what type of sorting is used in sort() and how is bool compare() passed as an argument to it.
How is sort() and bool compare() functions working here
The algorithm used by sort() is IntroSort. It is a hybrid sorting algorithm, which means that it uses more than one sorting algorithms as a routine. Introsort being a hybrid sorting algorithm uses three sorting algorithm to minimise the running time, Quicksort, Heapsort and Insertion Sort. Its syntax is:
sort(startaddress, endaddress, comparator)
where:
startaddress: the address of the first element of the array
endaddress: the address of the last element of the array
comparator: the comparison to be done with the array. (This argument is optional)
You can read more about introsort here: https://www.geeksforgeeks.org/know-your-sorting-algorithm-set-2-introsort-cs-sorting-weapon/
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.
yes it is resolved. Thank you.