Possible Duplicate:
A program that finds the Kth largest element in a list
I want to implement the median of median algorithm to find the largest element in a list in prolog. How exactly does it work because i know it succesively splits the list into 5 elements and then finds their medians and the median of medians and finally how i can write it?