C++: Combining two circular, doubly linked lists

Given two circular, doubly linked lists, write a function that combines them.

//--- Node for doubly linked list of floats.
struct Node {
    Node* next;  // Pointer to next element
    Node* prev;  // Pointer to previous element
    float data;
};

//--- Function prototype
Node* splice(Node* p, Node* q);

The splice() function should do the following:

Answer