lundi 30 mars 2020

Confused with complexity

    for key in string_list:
       if key in new:
          same.append(key)

I'm really bad with complexity and I am trying my to best learn. Is the complexity of this code O(n^2)? Because it is comparing 2 lists or is it O(n) as I just used one for loop. string_list and new are just two lists

Aucun commentaire:

Enregistrer un commentaire