my code is stopped.can anyone help me?
#include<iostream>
#include <cstdlib>
using namespace std;
int n;
int a[100];
struct bst{
int data;
struct bst* left;
struct bst* rigth;
}*node,*p,*q;
void insert(){
node->data=a[0];
for (int i = 0; i < n; i++)
{
/* code */
q->data=a[i];
p=node;
while (true)
{
/* code */
if(q->data<=p->data)
{
if(p->left==NULL)
{
p->left=q;
break;
}
else
{
p=p->left;
continue;
}
}
else if(q->data>p->data)
{
if(p->rigth==NULL)
{
p->rigth=q;
break;
}
else
{
p=p->rigth;
continue;
}
}
}
}
}
void display()
{
}
int main()
{
cin>>n;
//a=(int*)malloc(n*sizeof(int));
for (int i = 0; i < n; i++)
{
/* code */
cin>>a[i];
//cout<<*(a+i);
}
insert();
}
The binary search tree problem.