code: function rightInorder(n, x) {
    if(n <= 0) {
      return 0
    }
    var r = rootInorder(n)
    if(x > r) {
      return rightInorder(n-r-1, x-r-1) + r + 1
    } else if(x === r) {
      return rootInorder(n-r-1) + r + 1
    }
    return rightInorder(r, x)
  }
docs: for power of two minus one:  right = x + (1<<(h-1))