0

I have an assignment where I need to Sort the linked list according to Int Variable after the user has input the information.

When I try using bubble sort I'm stuck because I don't know how go back to the beginning.

If a user enters : 5 4 3 2 1

When Sorting it makes : 4 3 2 1 5

but then I'm stuck at 5 because I'm at the end of the linked list so I can't finish my Bubble Sort. (I can't use any builtin function or template because I need to learn this)

btw: I need to Sort the way they point to each other not by changing their Int value

```
void Sort_List(LinkList *list,int count)
{
LinkList *temp;
temp=list;
// for(int j=0;j<count-1;j++)
//{
for(int i=0;i<count-1;i++)
{
if (list->var>list->next->var)
{
list=list->next;
if (list->next!=NULL)
{
temp->next=list->next;
}
else
{
temp->next=NULL;
}
list->next=temp;
}
list=list->next;
}
//}
}
```

Please help me learn this. Thanks