DisUnknown Distilling Unknown Factors for Disentanglement Learning

less than 1 minute read

Published:

find median of two sorted arrays

  • what is median: same amount of elements smaller and larger than it
  • devide two arrays and assmue the two idxs are i and j
    • then i + j should be length sum / 2 (corner case: plus one? -> determines where the median is in the corner case)
    • move i according to some easy rules: bin search
    • corner case
      • we should allow the search interval be empty (while s <= e)
      • both array can be exhausted, check all boundary conditions
      • two median candidates from left and right site of the division, return one of them or the median of them (odd or even)