I have that question that looks kinda easy at first but it is quit hard.
Let $L\in P$ prove that $L^*\in P$
(L is a language and P is the class of all problems which can be decided by a deterministic poly time turing machine)
my approach:
I tried to generate a turing machine but I got stuck with the thing of the poly time machine, I only managed to create a non deterministic machine. I know that there is a complicated method with graphs or with dynamic programming, But I am asking for a full proof or a more gentle one "computational models" oriented and not with algorithmic approach but both proofs will be good.
Given a word $u=u_0\dotsm u_{n-1}$, it has $O(n^2)$ factors. Determining which ones belong to $L$ is therefore poly-time. From these you construct an oriented graph with the occurences of the factors in $L$ as vertices and with edges $u_k\dotsm u_{\ell-1} \longrightarrow u_\ell\dotsm u_{m-1}$. Then $u\in L^*$ if a suffix of $u$ is reachable from its prefix. Computing reachable states in a graph with $O(n^2)$ vertices is surely not worse than $O(n^4)$.
For example, for $L= ab^* \cup b^*a$ and $u={}_0a_1b_2b_3a_4a_5b_6a_7$, we have the factors $${}_0a_1,\ {}_0ab_2,\ {}_0abb_3,\ {}_1bba_4,\ {}_2ba_4,\ {}_3a_4, \ {}_4a_5,\ {}_4ab_6,\ {}_5ba_7,\ {}_6a_7$$ with a path, for instance, ${}_0abb_3\to {}_3a_4 \to {}_4a_5 \to {}_5ba_7$.