What is the complexity of this program. Is it O(n) or 0(1)?

Viewed 24

A simple sample program. I want to know if the "in" keyword makes the program of O(n) complexity when used here.

dummyList = [1, 4, 8, 7, 2]

num = 5

if num in dummyList:

    print("found")
0 Answers
Related