Intern
Specify the average asymptotics of time and additional memory for in-place quicksort when sorting a slice of n elements O(n log n) in time, O(log n) in stack memory O(n log n) in time, O(1) in memory O(n^2) in time, O(log n) in stack memory O(n log n) in time, O(n) in memory
sobes.tech AI
Answer from AI
Quick sort (in-place) on average operates in O(n log n) time. It uses call stack memory for recursion, with an average depth of O(log n). Therefore, the average asymptotics are:
- Time: O(n log n)
- Additional memory: O(log n) (due to the call stack)
An example from the options:
O(n log n) in time, O(log n) in stack memory
This is the correct answer. Other options are either incorrect in terms of time or memory.