Can u check my logic its not showing output

@supratik260699
there are lot of mistake in your code. I am pointing out those mistake

  1. your buildlist() function is wrong why are you iteration till n>-1. The function should be
    void buildlist(node*&head)
    {
    int n;
    cin>>n;
    int data;
    while(n>0)
    {
    cin>>data;
    insertattail(head,data);
    n–;
    }
    }
  1. there is mistake in print function. condition of while loop should be while(p!=nullptr)

its giving TLE i think u have not checked the function operation(),can u check it once please?