J
junky_fellow
Hi all,
I have a linked list in which each node is of follwoing type.
struct node {
struct node *fptr;
int data;
int flag; /* flag could be ORIG=1 or DUPLICATE=2 */
}
I need to write a function, that would manipulate the linked list so
that all the nodes
with flag = DUPLICATE are put at the end of the linked list.
for eg, let the original list be,
head---->DUPLICATE---->ORIG---->ORIG---->DUPLICATE ----->ORIG--->
NULL
The final list after manipulation should be,
head--->ORIG----->ORIG----->ORIG---->DUPLICATE------>DUPLICATE
------>NULL
Only requirement is that the nodes with flag = DUPLICATE should lie
at the end.
I don't want the exact code, I just need an algorithm or some hints.
Many thanks for any help in advance ...
I have a linked list in which each node is of follwoing type.
struct node {
struct node *fptr;
int data;
int flag; /* flag could be ORIG=1 or DUPLICATE=2 */
}
I need to write a function, that would manipulate the linked list so
that all the nodes
with flag = DUPLICATE are put at the end of the linked list.
for eg, let the original list be,
head---->DUPLICATE---->ORIG---->ORIG---->DUPLICATE ----->ORIG--->
NULL
The final list after manipulation should be,
head--->ORIG----->ORIG----->ORIG---->DUPLICATE------>DUPLICATE
------>NULL
Only requirement is that the nodes with flag = DUPLICATE should lie
at the end.
I don't want the exact code, I just need an algorithm or some hints.
Many thanks for any help in advance ...