Searching

Array backed lists provides a O(1) operational cost for searches if the index of the object is known in advance. Otherwise, all searches in lists cost O(n) for unsorted lists and O(log n) for sorted lists where a binary search pattern is applied. Binary search algorithms will be discussed in much greater detail in Chapter 13, Searching: Finding What You Need.

Get Everyday Data Structures now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.