The brute force way to find an element in a collection; we will look through every element until the desired one is found.
Pros | Cons |
---|---|
No constraints on the data set | Slowest brute-force way to find something |
Does not take advantage of any potential properties in the data set |
Performance | |
---|---|
Worst-case | O(n) |
Average | O(n) |
Best-case | O(1) |
Worst-case space | O(1) |