Right approach for insertion sort in list?

Is making one more list and adding elements to it in the sorted form the right approach or we cannot make one more list?

if u can do it inplace then its well and good as creating a new one will take O(N) space…

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.

https://ide.codingblocks.com/s/602944 why is the error in this code?

okay…let me see…

Hey @goyalvivek you can’t perform insertion functions operation in a STL linked list. Use inbuilt insert and lower_bound in order to achieve what you wanna do. Also if it’s difficult to understand, take reference from these