Question: class node _ 2 d { public: int data; node _ 2 d * next _ x; node _ 2 d * next _ y;

class node_2d {
public:
int data;
node_2d *next_x;
node_2d *next_y;
node_2d(int d, node_2d *x=nullptr, node_2d *y=nullptr){
data = d;
next_x = x;
next_y = y;
}
node_2d *insert_x(int d){
next_x = new node_2d(d,next_x);
return next_x;
}
node_2d *insert_y(int d){
next_y = new node_2d(d,nullptr,next_y);
return next_y;
}
};
node_2d *head = nullptr;
node_2d *tmp = nullptr;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!