code: function parentInorder(n, x) {
    if(n <= 0) {
      return -1
    }
    var r = rootInorder(n)
    if(x > r) {
      var q = parentInorder(n-r-1, x-r-1)
      if(q < 0) {
        return r
      } else {
        return q + r + 1
      }
    } else if(x === r) {
      return -1
    }
    var q =  parentInorder(r, x)
    if(q < 0) {
      return r
    }
    return q
  }
docs: The version for n = (1<<k)-1:  parent = (x & ~(1<<(h+1))) + (1<<h)