This questions is from my programming course but nevertheless it has mathematical background so I thought posting it here was the right place.
Suppose we want to add two polynomials $A(x),B(x)$ such that
$A(x) = a_{n-1}x^{n-1}+a_{n-2}x^{n-2}+...+a_{1}x^{1}+a_{0}x^{0}$ and
$B(x) = b_{m-1}x^{m-1}+b_{m-2}x^{m-2}+...+b_{1}x^{1}+b_{0}x^{0}$
these polynomials are written in the following format
$ (n,x_{n-1},a_{n-1},x_{n-2},a_{n-2},...,x_{0},a_{0}) $ this has length $2n+1$
$ (m,x_{m-1},b_{m-1},x_{m-2},b_{m-2},...,x_{0},b_{0}) $ this has length $2m+1$
now we have another polynomial $C(x)$ , such that $C(x) = A(x) + B(x) $ , the information regarding the problem claims that in the worst case a length of $2(m+n)+1$ is required for the polynomial $C(x)$ to be written like in the notation mentioned above.
I see it this way : We have three cases , mainly $ (m = n , m > n , m < n ) $
If $ m = n $ then the polynomial $C(x)$ needs only $2m+1$ cells since $ m = n $.
If $ m > n $ then for polynomial $C(x)$ still only needs $2m+1$ cells because $m>n$ and we copy $2(m-n)$ cells from $B(x)$ , and the rest of the cells are common for $A(x)$ and $B(x)$ because we have copied all the cells with greater exponents and from now both polynomials have same remaining exponents on their cells respectively.
If $n > m$ the situation is pretty much symmetric , this time the space being required is $2n + 1$.
My question is : Am I wrong , is there a case where space of $2(m+n)+1$ would be required to write $C(x)$ in the format mentioned above, that I fail to see ?
by space I mean the number of cells needed