Time-complexity of recursive defined code
The time complexity depends only on $n$ but not on $x$. You can assume $T(n)$ denote the time complexity. For $n\leq 1$, $T(n)=O(1)$ apparently. For $n&gt;1$, the first for-loop takes $O(n)$ time and the second for-loop takes $3T(n/3)$ time since it calls $b(n/3,\cdot)$ three times.