I am new to prolog language. I came across an interesting problem in prolog.
Generally, quicksort works well for large lists. But for smaller lists, insertion sort works better than quicksort. How can i write a sorting algorithm in Prolog that uses quicksort initially, but switches to insertion sort for sublists of 15 or fewer elements.
The hint is that we can count the number of elements during the partition operation. But i don't know how to form an algorithm for this problem. Can anyone please guide/help.
Thanks a lot in advance.