Continuous function changing signs an infinite number of times (part 2) (This is an extension of my previous question, sorry if it looks like a duplicate)
The function $g$ is continuous on $[a,b]$. I define a "trouble point" of order 1, $x$, as follows: $\forall \delta>0$, the interval $[x-\delta,x+\delta]$ contains both points where $g$ is negative and points where $g$ is positive, as well as points $y \neq x$ for which $g(y)=0$, i.e. $g$ changes signs on arbitrarily small neighborhoods of $x$. For example, $x=0$ is a trouble point of order 1 for $g(x)=x\sin(\frac 1 x)$. $a$ and $b$ are considered trouble points if the same rule applies for $[a,a+\delta]$ and $[b-\delta,b]$, respectively.
Furthermore, I define a "trouble point of order n" as a point $x$ for which, $\forall \delta>0$, the interval $[x-\delta,x+\delta]$ contains a trouble point $y \neq x$ of order n-1 (with $a$ and $b$ having matching definitions).
I know from my previous question that there can be an infinite number of trouble points of order 1 on $[a,b]$. My question now is, can there be a function $g$ such that $[a,b]$ contains trouble points of arbitrarily large order? Or must there be a trouble point of highest order (or no trouble points at all) on $[a,b]$, regardless of what $g$ is?
 A: Let $K\subset[0,1]$ be the Cantor set.  Each connected component of $[0,1]\setminus K$ is an open interval of length $3^{-n}$ for some $n$.  Define a function $g$ on $[0,1]$ which is $0$ on $K$, and on each component of $[0,1]\setminus K$ of length $3^{-n}$, has sign $(-1)^n$, approaches $0$ at the endpoints, and is continuous with maximum absolute value $1/n$.  Then $g$ will be continuous on all of $[0,1]$ (as you approach a point of $K$ along infinitely many components of $[0,1]\setminus K$, their length must go to $0$ so $g$ will approach $0$).  Every point of $K$ is a trouble point, since any neighborhood of a point of $K$ contains components of $[0,1]\setminus K$ of length $3^{-n}$ for all sufficiently large $n$.  So $g$ has uncountably many trouble points, and all of them have infinite order (since $K$ has no isolated points).
More generally, if $C\subset[0,1]$ is any closed set with empty interior, you can construct a continuous function on $[0,1]$ with $C$ as its set of trouble points by a similar construction, replacing $K$ with $C$.  (If $C$ has isolated points, you need to make the function oscillate around $0$ as it approaches the endpoints of each interval of $[0,1]\setminus C$ instead of just having constant sign.)  Note that the set of trouble points of a continuous function is always closed and has empty interior, so this is in some sense the strongest possible result.
