-2

What is the time complexity for appending an element to a list in Python?

  • 1
    Did you try to use a search engine to find an answer for this? What happened when you tried? – Karl Knechtel Dec 30 '21 at 08:28
  • Does this answer your question? [Why is the time complexity of python's list.append() method O(1)?](https://stackoverflow.com/questions/33044883/why-is-the-time-complexity-of-pythons-list-append-method-o1) – John Kugelman Jun 04 '22 at 01:28

1 Answers1

1

According official python docs adding an element to list has O(1) time complexity.

And if you want to copy a list it takes O(n), where n is a list size.

Ratery
  • 2,863
  • 1
  • 5
  • 26