-
I'm almost positive that this should work, I'm just having some difficulty adding the nodes to the new lists..
I'm calling the split function in main in a loop
Code:
for(r = 0; r < matrix->rows; r++)
split(matrix->m[r], &list_1, &list_2, r);
Here is the split function
Code:
void split (NODE *pList, NODE **list_1, NODE **list_2, int n)
{
int count;
NODE *pWalk;
count = 0;
pWalk = pList;
while(pWalk != NULL)
{
//printf("%d", pWalk->data);
//printf("(%d)", count);
//printf("r = %d ", n);
if(n <= count)
{
//add to list_1
}
else
{
//add to list_2
}
pWalk = pWalk->link;
count++;
}
//printf("\n");
return;
}