Let's trace num = "232", target = 8.
Start with "2" as first operand. val = 2, prev = 2.
Branch +: take "3". val = 5, prev = 3. Then + "2": val = 7. Not . Then - "2": val = 3. No. Then * "2": val = 5 - 3 + 3*2 = 8. Found "2+3*2".
Branch -: take "3". val = -1. Continue...
Branch *: take "3". val = 6, prev = 6. Then - "2": val = 4. Then + "2": val = 8. Found "2*3+2".
At each position, you can split the remaining digits in up to ways and choose operators. The branching factor gives roughly time in the worst case. Space is for the recursion depth.