hi as you may notice i am new here so hi nice to meet you:)..
uhhhmmm please help me on a project i'm working on about insertion using linked list my problem is on line 19-20 I can't seem to make it work,, when you type 9 7 6 4 2 it will display 9 2 4 6 7 so im pretty sure i'm very close can you point out what's wrong with my code tnx a lot :D
this is what i've done so far
void insertion_sort (int n)
{
struct node *p;
node * temp1 = NULL;
node * temp2 = NULL;
node * temp3 = NULL;
for (int i=1; i < n; i++)
{
p = start;
temp1 = p ;
for (temp2 = p->link; temp2->link != NULL; temp2 = temp2->link)
{
if (temp2->data > temp2->link->data)
{
temp3 = temp2->link;
temp1->link = temp2->link;
temp2->link = temp3->link;
temp3->link = temp2;
}
temp1 = temp2;
if( !temp2->link )
break;
};
}
}
Bold Text Here