Programs are not just single algorithms. And data is often in some internal partially digested representation in some sort of data structure. Optimizing can't just be done by improving algorithms and thinking of the data as a black box and just blinding switching algorithms. It requires understanding why and where a program is slow including considering the representation of data. BTW, even with the same data structure it's possible for algorithms to have different "n"s. Consider multi-indexed containers (e.g. Boost's) and algorithms that might work with them*.
* - And yes I know that you can often express the extent of one index as an function on the extent of another index in which case you have the same "n".