The way in which we store data for an algorithm has a huge impact on the scalability for that particular algorithm. Various data structures provide different complexity for different operations. The following sections describe various data structures and the characteristics of various operations.
Scaling data structures
Profiling data structures
The algorithm scalability choices also often manifest themselves in the choice of data structures. This table gives the time and space complexity of common data structures and their operations:
Data structure |
Time complexity |
Space complexity |
|||||
Average |
Worst |
Worst case |
|||||
Search |
Insert |
Delete |
Search |
Insert |
Delete |
||
Array |
O(n) |
O(n) |
O(n) |
O(n) |
O(n... |