Prove correctness of the following algorithm which is used


Prove correctness of the following algorithm which is used to determine if a list numbers is a part of other list of numbers. For example for inputs List1=[1,2,3] and List2=[5,6,1,7,2,5,6,3], the algorithm will return "List1 is part of List2" and list of positions [2,4,7]. Algorithm in Python:

def sublist(List1, List2, l1, l2):
if l1 == 0 or l2==0:
print ("List1 is not part of List2")
j=0
i=0
positions=[]
while j
if List1[j] == List2[i]:
positions.append(i)
j+=1
else:
i+=1
if len(positions)==0:
return print ("List1 is not part of List2")
else:
return print ("List1 is part of List2 "+str(positions))

Request for Solution File

Ask an Expert for Answer!!
Data Structure & Algorithms: Prove correctness of the following algorithm which is used
Reference No:- TGS01281165

Expected delivery within 24 Hours