title: K Th Element Two Sorted Arrays
signature: kThElementTwoSortedArrays :: [Integer] -> [Integer] -> Integer -> Integer -> Integer -> Integer
  kThElementTwoSortedArrays arr1 arr2 m n k = 
source_py: def k_th_element_two_sorted_arrays(arr1, arr2, m, n, k):
      sorted1 = ([0] * (m + n))
      i = 0
      j = 0
      d = 0
      while ((i < m) and (j < n)):
          if (arr1[i] < arr2[j]):
              sorted1[d] = arr1[i]
              i += 1
          else:
              sorted1[d] = arr2[j]
              j += 1
          d += 1
      while (i < m):
          sorted1[d] = arr1[i]
          d += 1
          i += 1
      while (j < n):
          sorted1[d] = arr2[j]
          d += 1
          j += 1
      return sorted1[(k - 1)]
source_cpp: int k_th_element_two_sorted_arrays(vector<int> arr1, vector<int> arr2, int m, int n, int k) {
    int sorted1 [ m + n ];
    int i = 0, j = 0, d = 0;
    while ( i < m && j < n ) {
      if ( arr1 [ i ] < arr2 [ j ] ) sorted1 [ d ++ ] = arr1 [ i ++ ];
      else sorted1 [ d ++ ] = arr2 [ j ++ ];
    }
    while ( i < m ) sorted1 [ d ++ ] = arr1 [ i ++ ];
    while ( j < n ) sorted1 [ d ++ ] = arr2 [ j ++ ];
    return sorted1 [ k - 1 ];
  }