# Space Complexity is another criteria to check Algorithm's Efficiency. It is called "Space Complexity " (we already know about the "Time Complexity 😎")
# The "Space Complexity" is the extra Memory Space needed by an Algorithm due to change in the input size.
# Space Complexity Computing ...
# To compute Space Complexity, we don't need to consider the Input Size (n).
# We just need to consider the Extra Variables or Extra List that created by the Algorithm.... 🙂
# For Example:
# Like, the Bubble Sorting and Selection Sorting Algorithm we have created 'Temp' Variable, it was made for every Loop and overrided,
# so, to compute it's 'Space Complexity' we need to consider the 'Temp' variable, that's it. (like how many times it was created and overrided)
# Space Complexity doesn't depend on how many Loop are creating, rather it depends on How many new Variables or Lists are creating,
# If you don't create any new array, the Space Complexity will be 'O(1)' :). |
# If you declare an Array that depends on the input (n). Then the Space Complexity will be " O(n) " :D ...... ||
0 Comments