I'm wondering what's the Big O running time of the below simple program:
dates = [0,2,3,4]
sample_list = [1,2,3,4]
for i in range(0, 4):
sub_list = sample_list[i+1:]
if dates[i] in sub_list:
count += 1
Is the running time O(n)
or O(n**2)
? I know the running time is at lease O(n)
because I have a for loop, but how about the if dates[i] in sub_list
statement? What's the running time for that?