7X FASTER way to insert item at start of Python list 🐍 #shorts #python

preview_player
Показать описание
Which way is faster when inserting an item to the beginning of a list:
1. l1 = [3] + l1
Insert is about 5 to 7 times faster!!!
Рекомендации по теме
Комментарии
Автор

Insert method is still O(n) time though right? But we save on memory?

hamoodhabibi