**New course!**Every coder should learn

**Generative AI!**

0

# Find the time complexity of the findNode() method from this code.

Time complexity of an algorithm https://code.sololearn.com/cjmldlLPUlj5/?ref=app

1 Answer

+ 1

It's O(n). The function is more complicated than necessary so may check each node up to 2 times. So it could be twice as fast in the worst case, but would still be O(n).