A very basic algorithm, involving the Monte-Carlo-Method to find the Fourier-Series Approximation of a given Signal.
The following image shows the result of the approximation of a sine wave (red). The longer the runtime of the algorithm, the better the approximation. The label of the blue line shows the error associated with the output, which is connected to the area difference between the two lines. The algorithm aims to reduce this area by randomly varying the parameters of a Fourier-Series. If the result is minimizing the area, it will be accepted, otherwise it will be discarded. This idea is called "Monte-Carlo-Method" and has wide applications in Science. The runtime associated with these kinds of algorithms can be huge. Even though approximating the sine wave with a Fourier-Series is a trivial example, the algorithm can be applied to any given signal.