I made changes here but still getting the same error and clear the previous anomalies

First:
Don’t open multiple doubts, respond here only
Secondly:
Don’t sort

if(t!=0){//odd
        l1.push_front(a);
                }
        else{//even
        l1.push_back(a);
           }
        }
			//l1.sort();
        for(auto x:l1){
               cout<<x<<" ";
           }

This will led to output: 5 1 1 2 2 8 6
so now what’s causing an issue?
Think like this as you want to solve it using STL
L1(for odd linked list)
L2(for even linked list)
Now suppose you get input:
1 2 2 1 8 5 6

  • now 1 comes insert at back of L1{1}
  • now 2 comes insert at back of L2{2}
  • now 2 comes insert at back of L2{2,2}
  • now 1 comes insert at back of L1{1,1}
  • now 8 comes insert at back of L2{2,2,8}
  • now 5 comes insert at back of L1{1,1,5}
  • now 6 comes insert at back of L2{2,2,8,6}
    Now print L1+L2 = {1,1,5,2,2,8,6}
    Simple, This is what we want

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.