Q2: why is the time complexity linear for the list when for binary search its log(n) for n no. of elements and
Q9: here algorithm refers to the whole code or just reverse function? because space complexity for revserse function is O(1) and for whole code its O(n) since it uses variable rev correct me if I m wrong.
Answers for Q2 and Q9?
@namanmittal0007 in list mid point calculation takes o(n) time so for list its linear.
In second acc to the question language it should be o(n) and o(n)
dont forget to hit like and mark resolved if cleared 
no, i got the ans that its o(n) and o(n) for both space and time but i wanted to know that here algorithm means reverse function or the complete code provided, and please tell what is the time and space complexity of reverse function alone?
so it means space complexity O(n) is because of the variable rev and not the reverse function?
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.