From the course: Programming Foundations: Data Structures (2023)

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

When to use array-like structures

When to use array-like structures

- [Instructor] Array-like structures, like tuples and lists are great data structures to use when working with sequential data. They're easy to use and understand. In fact, these structures are often used as the backbone for the implementation of other data structures, such as a dictionary, a queue or a set. However, they do have disadvantages. Lists in python are dynamic, which means they can grow or shrink as needed, but this can lead to a larger memory overhead. They're also not optimized for speed. Certain operations, such as searching or sorting, can be slow for large data sets. If you know exactly what index you want to access, retrieving elements is fast with a constant time complexity or O of one, but most of the time you'll likely not know what index you want to access. Understanding the pros and cons of each data structure can be useful for determining which one organizes your data in the best way for your use…

Contents