hi ! how can i do a one-way-circular linked list function that gives to me** merge 3 lists** such as

struct node{
    int data;
    node *flink;
    node *blink;
};
void concatenate(node *&L1,node *L2,node *L3)
{
 ???
}

Recommended Answers

All 2 Replies

Well, depends on your merging. If you need only to concatenate the lists, than you should set your 1st list tail node to the head of your 2nd list(blink), and the tail of your 2nd list to the head of your 3rd list. To make it a circular list, set the tail (flink) of your 3rd list to the head of your 1st list, thus completing the circle.
If you want a mearging function, I suggest you look uppon the mearge sort.
Probably you should keep a head and a tail node in each list.

yes i understand thank you so much :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.