title: selection algorithm for median
body: <p>I was trying to understand the selection algorithm for finding the median. I have pasted the psuedo code below.</p>
  
  <pre><code>SELECT(A[1 .. n], k):
  if n&lt;=25
  use brute force
  else
  m = ceiling(n/5)
  for i=1 to m
  B[i]=SELECT(A[5i-4 .. 5i], 3)
  mom=SELECT(B[1 ..m], floor(m/2))
  r = PARTITION(A[1 .. n],mom)
  if k &lt; r
  return SELECT(A[1 .. r-1], k)
  else if k &gt; r
  return SELECT(A[r +1 .. n], k-r)
  else
  return mom
  </code></pre>
  
  <p>i have a very trivial doubt. I was wondering what the author means by brute force written above for i&lt;=25. Is it that he will compare elements one by one with every other element and see if its the kth largest or something else.</p>