** Javascript Data structure **
(Big O Notation)
Time Complexity
O(1): no matter how big the job is, it takes the same amount of time to complete. It's like saying, "It's a one-size-fits-all speed, and the size of the task doesn't matter."
O(n): If you have a process with O(n) complexity, doubling the size of the input will roughly double the time it takes to finish the task. It scales linearly with the input size.
Space Complexity
O(1) space complexity: This means that the amount of memory used by an algorithm or operation remains constant, regardless of the size of the input data. It's often considered very efficient because the memory usage doesn't grow as the input size increases.
O(n) space complexity: This means that the amount of memory used by an algorithm or operation grows linearly with the size of the input data. As the input size increases, the amount of memory used also increases proportionally.
Top comments (0)