Find a sequence of functions $\{g_n\}$ in $C([0,1])$ so that $\overline{\{g_n\}}$ is compact, but $g_n$ does not converge uniformly.

compactnessreal-analysisuniform-convergence

Consider the space $C([0,1])$ equipped with the uniform norm.
Find a sequence of functions $\{g_n\}$ in $C([0,1])$ so that $\overline{\{g_n\}}$ is compact, but $g_n$ does not converge uniformly.

I can't seem to find a sequence of function that satisfy the above statement. I started off by finding a non-uniform convergence sequence and work from there but no luck.

Any help would be greatly appreciated.

Best Answer

For each $n\in\mathbb N$ and each $x\in[0,1]$, define $g_n(x)=(-1)^n$.