Sorted insert problem

i am always getting the element to be inserted at head position

@Vipul.kapoor
there is mistake in line no 31. You are using || operator, you should use &&. Since n!=NULL is always true, you code always enters in that if condition and insert element at head position. Just change line 31 to if(n!=NULL && n->data<=head->data)

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.