Hi @Amanda_Varella ,

The space complexity of bubble sort is O(1) because the algorithm only requires constant additional memory to store into temporary variables for swapping data.

According to the provided code of our bubble sort algorithm in the given lesson, the worst case space complexity is O(1) because we didn’t use any additional memory.

If and only if a scenario comes, where the array is not present in the memory as explained in the “Worst Space” section of the lesson. Only for this case, we would require additional O(n) space to load the array into the memory (where n is the number of elements in the array).

I hope this answers your query.

Thanks!

Happy Learning