code: function heightInorder(n, x) {
    if(n <= 0) {
      return 0
    }
    var r = rootInorder(n)
    if(x > r) {
      return heightInorder(n-r-1, x-r-1)
    } else if(x === r) {
      return bits.log2(n)
    }
    return heightInorder(r, x)
  }
docs: This is really horrible because n is not necessarily a power of 2 If it was, we could just do:  height = bits.countTrailingZeros(~x)  Instead, we just binary search because doing the right thing here is way too complicated.