4-Data Structures Operations and Its Cost Estimation
4-Data Structures Operations and Its Cost Estimation
1. Access/Search:
2. Insertion:
3. Deletion:
4. Traversal:
5. Sorting:
6. Merging:
7. Splitting:
Cost Estimation:
Time Complexity:
Definition: Measures the amount of time an algorithm takes with respect to its input
size.
Notation: Big O notation (O(f(n))).
Example: If an algorithm’s time complexity is O(n), it means the running time grows
linearly with the input size.
Space Complexity:
Definition: Measures the amount of memory an algorithm uses with respect to its input
size.
Notation: Big O notation (O(f(n))).
Example: If an algorithm’s space complexity is O(1), it means the memory usage
remains constant regardless of the input size.
Examples:
Array:
Linked List:
Hash Table:
Related posts: