We can compare algorithms based on the following method
We can compare algorithm based on the time it takes to execute some input. But the thing is the execution time is machine dependent.
No of statements executed
We can compare algorithm based on no of statement but it is also not a good measure because for different language the no of statement would be different for same algorithm. Also no of statements also depends on the code style of programmer.
So what we can do ideally is express the runtime of an algorithm as a function of input size n as f(n). Comparing algorithms like this is independent of machine time and programmer style.