committed by
					
						
						Niraj Nandish
					
				
			
			
				
	
			
			
			
						parent
						
							109ee74af6
						
					
				
				
					commit
					dff64a339d
				
			@@ -128,7 +128,14 @@ int main()
 | 
			
		||||
    return 0; 
 | 
			
		||||
} 
 | 
			
		||||
```
 | 
			
		||||
The space complexity of quick sort is O(n). This is an improvement over other divide and conquer sorting algorithms, which take O(nlong(n)) space. Quick sort achieves this by changing the order of elements within the given array. Compare this with the <a href='https://guide.freecodecamp.org/algorithms/sorting-algorithms/merge-sort' target='_blank' rel='nofollow'>merge sort</a> algorithm which creates 2 arrays, each length n/2, in each function call.
 | 
			
		||||
 | 
			
		||||
## Complexity
 | 
			
		||||
 | 
			
		||||
| Name                  | Best            | Average             | Worst               | Memory    | Stable    | Comments  |
 | 
			
		||||
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
 | 
			
		||||
| **Quick sort**        | n log(n)   | n log(n)       | n<sup>2</sup>       | log(n)    | No        |  Quicksort is usually done in-place with O(log(n)) stack space |
 | 
			
		||||
 | 
			
		||||
The space complexity of quick sort is O(n). This is an improvement over other divide and conquer sorting algorithms, which take O(n log(n)) space.
 | 
			
		||||
 | 
			
		||||
#### More Information:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user