0

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?

Community
  • 1
  • 1
Wasswa Samuel
  • 2,139
  • 3
  • 30
  • 54
  • 1
    You want to find the largest element? Then there's a very simple linear-time algorithm and you don't need median-of-medians at all. – Fred Foo Apr 04 '11 at 17:42
  • 1
    Duplicates the user's last question: [A program that finds the kth largest element in a list](http://stackoverflow.com/questions/5504785/a-program-that-finds-the-kth-largest-element-in-a-list), down to the confusion over whether the largest or some other element of the list is sought. – hardmath Apr 04 '11 at 18:07

0 Answers0