Selecting the right data structure

Selecting the right data structure can have a profound impact on the performance of a program. If your program requires you to spend considerable time on lookups, use a dictionary, if feasible. When all that you need is to traverse over a collection, prefer lists over dictionaries because dictionaries take up more space. When your data is immutable, prefer tuples over lists because tuples can be traversed faster than lists.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.170.223