How can I find which function corresponds to a set of data points?
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$).