Definition 1. A function $t: [a, b] \rightarrow \mathbb{R}$ is called a step function when a $k \in \mathbb{N}$ and numbers $z_0,...,z_k$ with $a = z_0 \leq z_1 \leq ... \leq z_k = b$ exist, such that for all $i \in \{1,2,...k\}$ the restriction $t |_{(z_{i-1},z_{i})}$ is constant.
Set $T([a,b])=\{\text{step functions on}\; [a,b]\}$.
(1) Let $f\colon [0,1] \rightarrow \mathbb{R}$ be defined by $$f(x) = \left\{ \begin{array}{rcl} 1, & \mbox{if} & x \in \mathbb{Q} \\ 0, & \mbox{if} & x \notin \mathbb{Q} \end{array} \right.$$
(2) Let $h\colon [0,1] \rightarrow \mathbb{R}$ be defined by $$h(x) = \left\{ \begin{array}{rcl} x, & \mbox{if} & x \in \{\frac{1}{n}:n\in\mathbb{N}\} \\ -x, & \mbox{if} & x \notin \{\frac{1}{n}:n\in\mathbb{N}\} \end{array} \right.$$
(a) Is $f$ regulated (https://en.wikipedia.org/wiki/Regulated_function ($\star$)), i.e.: Does $f$ satisfy: $\forall \epsilon>0$ exists $\tau\in T([0,1])$ satisfying $\|f-\tau\|_{\infty}=\sup\limits_{x\in[0,1]}|f(x)-\tau(x)|<\epsilon$?
(b) Is $h$ regulated?
Regarding (a): I think that $f$ does not have the desired property, essentially because $\mathbb{Q}$ and $\mathbb{R}\setminus \mathbb{Q}$ are dense in $\mathbb{R}$. Take $\epsilon =1/2$. If $f$ has the property $\star$, then there exists $\tau\in T([0,1])$ such that $\|f-\tau\|_{\infty}=\sup\limits_{x\in[0,1]}|f(x)-\tau(x)|<1/2$, i.e. $1/2>\sup\limits_{x\in[0,1]}|f(x)-\tau(x)|=|f(x')-c|$, since $\tau$ is piecewise constant (probably here I have to be careful that $x'\neq z_i$ ). The distance $ |f(x')-c|$ is either $|c|$ or $|1-c|$, depending on if either $x'\in\mathbb{R}\setminus\mathbb{Q}$ or $x'\in\mathbb{Q}$. How to proceed? There must be a contradiction somewhere. Or how else to do it?
Regarding (b): My guess is that $h$ is regulated, but I'm not sure. However, I'm not sure how to define a suitable step function $\tau$ depending on $\epsilon$. Or is $h$ not regulated as well?
Hints:
For (a) - consider looking at a sufficiently small ball around $x'$ (since $\tau$ is a step function you can find a $\delta$ such that its constant on $(x'-\delta, x'+\delta)$).
For (b) - choose a small positive number $z$ and consider separately the functions $h|_{[0, z]}$ and $h|_{[z, 1]}$. For the former, $|h|$ is trivially bounded by $z$. For the latter, there are only finitely many discontinuities to worry about.