I found out that the complexity of the quick-sort space without the Sedgewick trick to eliminate tail recursion is O (n). But if we track calls on the stack that are stored, these are O (log n) steps for any call, as shown in the figure.
On the image
when calculating the value (1,1), the calls are saved [(1,8), (1,4), (1,2)],
when calculating the value (3.3), calls are saved [(1,8), (1,4), (3,4)], etc.
which make up only O (log n) space at time ant. Then does the complexity become O (n)?
source
share