Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)
Recently I got to know that in Python how various data structures can make your code more efficient. During my investigation, I came across how lists and deques operate, I want to know how a deque is executed, and also of its downsides with respect to lists.

1 Answer

0 votes
by (108k points)
edited by

Please be informed that a deque object is comprised of a doubly-linked list of nodes.

Explanation:

Note that Python lists are for accessing the elements and fixed-length operations, which also includes slicing, while deques are much more useful for adding and deleting elements off the ends, with indexing being possible but the process is slower than with lists.

If you are a beginner and want to know more about Python, then do check out the below Python tutorial video that will help you in understanding the topic in a better way:

Browse Categories

...