115k views
1 vote
what is the order (big o) of the operation that determines if an item is in a list in an unsorted, array-based implementation?

User ADH
by
8.3k points

1 Answer

3 votes

The order (big o) of the operation that determines if an item is in a list in an unsorted, array-based implementation is O(n), where n is the number of elements in the array. This is because in the worst case scenario, the item being searched for may be at the end of the array, requiring a linear search through all elements of the array. Therefore, the time it takes to determine if an item is in the list increases linearly with the size of the array.

User Jdobry
by
7.9k points