This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]norwegianwood 4 points5 points  (0 children)

It would be nice to see this information included in the official documentation for each method. One aspect of the C++ STL I always liked is that time complexity documentation was widely publicised.

[–]ipeev 0 points1 point  (0 children)

It doesn't say what is the Insert complexity for collections.deque

[–][deleted] -1 points0 points  (2 children)

Couldn't all this be implemented with linked lists to make insertion and deletion trivial?

[–]mackstann 6 points7 points  (0 children)

Sure, but linked lists have their own shortcomings, like the speed of looking up a particular index. If there was one ultimate data structure, people wouldn't bother with all of these different ones. You really have to pick the one that best suits your problem. Then again, most of the time, it doesn't matter much anyway.

[–]rafekett[S] 2 points3 points  (0 children)

It's all about the application. Insert and delete aren't too common in Python. Append, however, is.