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 - Python Tutorial
From the course: Programming Foundations: Data Structures (2023)
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
-
-
-
-
What is an array?3m 31s
-
(Locked)
Create a list in Python2m 27s
-
(Locked)
Retrieve data from a list in Python4m 26s
-
(Locked)
Mutate a list in Python2m 57s
-
(Locked)
Multidimensional lists7m 15s
-
(Locked)
Tuples in Python2m 45s
-
(Locked)
Search array-like structures4m 47s
-
(Locked)
Sort array-like structures5m 1s
-
(Locked)
Challenge: Find the second smallest item1m 35s
-
(Locked)
Solution: Find the second smallest item4m 26s
-
(Locked)
When to use array-like structures1m 15s
-
-
-
-
-
-
-