I am trying different types of sorting algorithms and I understand the concept of asymptotic time and space complexity.
I am wondering whether we can write some logic in the program itself to calculate the space/time complexity of that algorithm so that we can have a proof that the algorithm behaves as expected?
Does anyone have any thoughts on this?