I saw in wiki and some other text, they said space complexity of bubble sort, insertion sort, selection sort, etc is O(1) auxiliary. Are they referring to constant memory cells that will be required for variable used in programs.
2 Answers
Yes they are referring to the fact that most sorts are in place sorts so they have a constant memory use. If the sort was not in place then it would require O(n) extra memory at the minimum.
2 Comments
Sneftel
And for something like quicksort, the auxiliary space is O(log n) because of the recursions.
cellepo
About "in-place": Since in-place uses the existing memory used for the unsorted list (usually just swapping elements within there), the additional "auxilary" memory for any algorithm variables is what is paid attention since that is the "extra space" cost [beyond the original space of the list itself].
If an algorithm works without any addition space or memory it's called "in situ"
http://en.wikipedia.org/wiki/In_situ
An algorithm is said to be an in situ algorithm, or in-place algorithm, if the extra amount of memory required to execute the algorithm is O(1)
1 Comment
cellepo
This is true, but is tangential to answering the question (it does not answer it). And "in situ" is just a synonym for the more common "in-place".