In order to approximate the exit time of a one-dimensional diffusion process, we propose an algorithm based on a random walk. Such an algorithm was already introduced in both the Brownian context and in the Ornstein-Uhlenbeck context. Here the aim is therefore to generalize this efficient numerical approach in order to obtain an approximation of both the exit time and position for either a general linear diffusion or a growth diffusion. The efficiency of the method is described with particular care through theoretical results and numerical examples.