Palindrome in linklist segmentation fault

CODE-
#include
using namespace std;
class node
{
public:
int data;
node* next;
node(int x)
{
data=x;
next=NULL;
}
};
class linklist
{
public:
node* head;
node* tail;
linklist()
{
head=NULL;
tail=NULL;
}
void Insertion(int x)
{
node* n=new node(x);
if(head==NULL)
{
head=n;
tail=n;
}
else
{
tail->next=n;
tail=n;
}
}
bool palindrome(node* head,node* temp)
{
while(temp->next!=NULL)
{
palindrome(head,temp->next);
}
while(head->data==temp->data)
{
head=head->next;
if(head->data!=tail->data)
{
return false;
}
}
return true;
}

};
int main()
{
linklist l;
int n;
cin>>n;
while(n–)
{
int x;
cin>>x;
l.Insertion(x);
}
node* temp=l.head;
cout<<boolalpha<<l.palindrome(l.head,temp);

return 0;

}

// i cant find where is the problem

Please share the link of Code

How to Share Link of Code??

  1. paste your code at https://ide.codingblocks.com/

  2. click->file->save

  3. after a link will be generated at top in place of url something like: https://ide.codingblocks.com/s/12345

  4. share this link