I was wondering what the Big-O of this code snippet is
def clear_list(my_list):
while len(my_list) > 0:
my_list.pop(0)
return my_list
Would it be O(n^2) or O(n) because the while loop is O(n) or O(1) and pop(0)
is O(n) as well. I don't think the while loop is O(log n) since no value that is being compared in the while loop is cut in half.