From the course: Programming Foundations: Data Structures

Unlock the full course today

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

Big O notation

Big O notation

- In order to decide which data structure to use or whether a given structure fits our needs, we need a way to compare them. One way to compare them is with big O notation. Big O notation describes the performance or complexity of an algorithm independently of input. Essentially, it tells you how efficient an operation is. Now, how does this relate to data structures? For a given data structure, there are a series of operations we can perform on it. This might mean inserting data, updating items, searching for data, and more. For each of these operations, we can come up with its time complexity or how long it takes to run independent of input. By comparing the time complexities of different operations across different data structures, we can decide whether or not one fits our use case better than another. Let's talk about a few different time complexities an operation can have. First, there's constant time complexity, or O of…

Contents