What would be the complexity of converting a string to its equivalent number or vice versa? Does it change depending on programming language?
On the face of it, one ne
To convert to a number you always have to read all digits. So it's at least O(n).
O(n)
Now doing something like (pseudocode)
a = 0 foreach digit in string do a = 10 * a + digit end
Is O(n). So the complexity is O(n)