title: Find the middle element in merged arrays in O(logn)
body: <p>We have two sorted arrays of the same size n. Let's call the array a and b.</p>
  
  <p>How to find the middle element in an sorted array merged by a and b?</p>
  
  <pre><code>Example:
  
  n = 4
  a = [1, 2, 3, 4]
  b = [3, 4, 5, 6]
  
  merged = [1, 2, 3, 3, 4, 4, 5, 6]
  mid_element = merged[(0 + merged.length - 1) / 2] = merged[3] = 3
  </code></pre>
  
  <p>More complicated cases:</p>
  
  <p>Case 1:</p>
  
  <pre><code>a = [1, 2, 3, 4]
  b = [3, 4, 5, 6]
  </code></pre>
  
  <p>Case 2:</p>
  
  <pre><code>a = [1, 2, 3, 4, 8]
  b = [3, 4, 5, 6, 7]
  </code></pre>
  
  <p>Case 3:</p>
  
  <pre><code>a = [1, 2, 3, 4, 8]
  b = [0, 4, 5, 6, 7]
  </code></pre>
  
  <p>Case 4:</p>
  
  <pre><code>a = [1, 3, 5, 7]
  b = [2, 4, 6, 8]
  </code></pre>
  
  <hr>
  
  <p>Time required: O(log n). Any ideas?</p>