What is best and worst case complexity for each of programs


Problem

def names(guess:tuple, hidden:tuple) -> int:
correct = 0
for name in ('jack','lee','ryan','lloyd','Bryan','lewis'):
if name in guess and name in hidden:
correct = correct + 1
return correct
names(('jack','lee','ryan','lloyd'),('lewis','Bryan','jack','lee'))

def positions(guess:tuple, hidden:tuple) -> int:
right = 0
for position in range(0,4):
if guess[position] == hidden[position]:
right = right + 1
return right
positions(('jack','lee','ryan','bryan'),('jack','ryan','lee','bryan'))

What is the best and worst case complexity for each of these two programs? Is there no worst case or best case complexity since both programs go through each name no matter the values inputted and doesn't end earlier?

Request for Solution File

Ask an Expert for Answer!!
Python Programming: What is best and worst case complexity for each of programs
Reference No:- TGS03323564

Expected delivery within 24 Hours