Question: void InsertInOrder ( martry a ) { node * p = new node; p - > location = a . location; p - > Name.push

void InsertInOrder(martry a)
{
node* p = new node;
p->location = a.location;
p->Name.push_back(a);
p->Date.push_back(a);
node* p1,* p2;
p1= cursor;
p2= NULL;
while (p1 && p1->location < a.location)
{
p2= p1;
p1= p1->next;
}
if (!p1 && !p2)
{
cursor = p;
}
else if ((!p1 && p2)||(p1 && p2))
{
p->next = p1;
p2->next = p;
}
else if (!p2 && p1)
{
p->next = p1;
cursor = p;
}
n++;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!