title: comparing numbers to sort then get median value
body: <p>Sorting five integers using bitwise or comparison operators can be achieved by first getting the highest number then the second highest then the third and so on.</p>
  
  <p>Here is my code in getting the highest number:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main() {
      int a, b, c, d, e;
      int aa, bb, cc, dd, ee;
  
      a = 4; b = 2; c = 5; d = 1; e = 3;
  
      aa = (a &gt; b) ?
           ((a &gt; c) ? ((a &gt; d) ? ((a &gt; e) ? a : e) : ((d &gt; e) ? d : e)) :
                      ((c &gt; d) ? ((c &gt; e) ? c : e) : ((d &gt; e) ? d : e))) :
           ((b &gt; c) ? ((b &gt; d) ? ((b &gt; e) ? b : e) : ((d &gt; e) ? d : e)) :
                      ((c &gt; d) ? ((c &gt; e) ? c : e) : ((d &gt; e) ? d : e)));
  
  
      printf("highest: %d\n", aa);
      return 0;
  }
  </code></pre>
  
  <p>I think getting the second, third, forth and fifth highest number could be possible using this method.</p>
  
  <p>Is there any other way in getting the median of five integers using comparison/bitwise operators? any other combinatorial method might be valid.</p>
  
  <p>By the way, I'm going to implement this algorithm in hardware.</p>
  
  <p>Using combinatorial method in sorting will be fast rather than using a state machine.</p>