Posts

Showing posts from July, 2025

Data Structures : Time Complexity

 Time Complexity Time complexity is a way to describe how the execution time of an algorithm increases as the size of the input grows. It is a measure of algorithm efficiency. Time complexity is usually expressed using Big O notation. ✅ Key Concepts ----------------------- Input Size (n):  Represents the amount of data the algorithm is processing.  Number of Operations:  Refers to the basic steps the algorithm takes (like comparisons, assignments, arithmetic operations, etc).  Big O Notation:  A mathematical notation used to classify algorithms based on their time complexity.  ✅ Common Time Complexities ---------- O(1): Constant Time: The algorithm takes the same amount of time regardless of the input size. Example: Accessing an element in an array by its index.  O(log n): Logarithmic Time: The runtime increases logarithmically with the input size. Example: Binary search...