Suppose I have a set of data points like this:
1;1
2;4
3;9
4;16
5;25
6;36
...
The first column is the input of the function and the second one is the result. I can tell if I look at it that the function here is y = f(x^2). The problem is that the data points are not always this obvious and I want to write a program which can tell me the definition of the function.
How can I do so?
Some context: I'm trying to write a program which can be used to analyze asymptotic time complexity of algorithms. So in fact I'm only interested in a predefined set of functions:
y = f(n)
y = f(log(n))
y = f(n * log(n))
y = f(n ^ m)
y = f(2 ^ n)

In general, if you have a set of points, there are infinitely many different functions passing through those points. For example, if you had the data $(1;2),(2;4),(3;8),(4;16)$, it'd be "obvious" that it's the function $f(n)=2^n$... but it could just as well be $f(n)=\frac{1}{3}(n^3-3n^2+8n)$.
If you restrict yourself just to some specific "candidate" functions in advance, you can simply compare the data you have with the values predicted by the particular function -- and if they match, declare the function to be the "right" one.
That being said, based on your description of the context, it seems your problem might be a better fit for Least Squares fitting method. This is especially true if your data is based on experiments (such as measuring the actual time taken by the program); since it's likely to be affected by "noise" (measurement imprecision; effect of some smaller factors which become negligible for large values of the parameters, ...). The Least-Squares method allows you to find the "best" fit of a particular function (which contains some unknown parameters) to the data you have and also to measure the "quality" of the fit (= how much do the function values with the optimal choice of those unknown parameters differ from your data).
For example, you can use it to fit the function $f(n)=an^3+bn^2+cn+d$, where $a$, $b$, $c$ and $d$ are unknown parameters. The method will give you the best possible choice of those parameters so that the function is as close to your data as it can get (in your example case, it'll give you $a=c=d0$ and $b=1$) and a value which measures the difference between your data and the resulting function (which will be zero in this example, since the data corresponds exactly to $f(n)=n^2$).