Difference in Space Complexity of different sorting algorithms
问题 I am trying to understand Space Complexities of different sorting algorithms. http://bigocheatsheet.com/?goback=.gde_98713_member_241501229 from the above link I found that the complexity of bubble sort,insertion and selection sort is O(1) where as quick sort is O(log(n)) and merge sort is O(n). we were actually not allocating extra memory in any of the algorithms. Then why the space complexities are different when we are using the same array to sort them? 回答1: When you run code, memory is