# What is the time complexity of SLR and LALR parsers?

What is the difference between time complexity of SLR(k) and SLR(1)? and also what about LALR(k) and LALR(1)?

How can I calculate time complexity of parsers? I think time complexity of LR(k) is O(n) but I'm not sure there is a relation between LR(k) and SLR(k) or LALR(k)!

They all run linear time with regards to input length ($$O(n)$$). The different algorithms have different memory trade offs for making it easier to write grammar for. That is not all grammars that work for LR(1) work for SLR for example. However LR(1) uses more memory than SLR which used to be a problem, but not really a problem anymore for modern machines.
LR(k) is rarely used. It hogs up an exponential amount of memory with regards to $$k$$. However any grammar for LR(k) can be rewritten for LR(1). And LR(1) handles all the languages LR(k) can, and vice versa. So most stick to LR(1) instead of LR(k).
All of those shift reduce parsers mentioned do a fixed maximum amount of work (with regards to the grammar itself) for each token feed to them. So they are all $$O(n)$$.