Hi I'm trying to do a sub-list search algorithm in python that I found here, need some efficient solutions in terms of time complexity. What I tried is:
l1 = [1,2,3,4]
l2 = [3,5,6,1,2,3,4,6]
l1_index = 0
l = len(l1)
sublist = []
for i in range(len(l2)):
if l1[l1_index] == l2[i]:
sublist.append(l2[i])
l1_index += 1
print("found")
if len(sublist) == l:
break
continue
else:
print("not found")
l1_index = 0