This is O(n) .
Since Where is O(n) , this means that the value of Where is approximately A xn , for some A
Similarly, ToList and ForEach also O(n) , which means that their cost is approximately equal to B xn and C xn respectively, for some B and some C
This means that the total cost is approximately equal to:
(A xn) + (B xn) + (C xn) = (A + B + C) xn = D xn
For some D (we were never interested in the fact that there were A , B and C , so itβs also not important for us that A + B + C , so just name it D to make our equation simpler).
Therefore, this operation is O(n) .
source share