15,908,768 members
1.00/5 (1 vote)
See more:
A 3-dimensional NX NX N array has to be rotated by K-times. One rotation is a combination of two operations, a backward rotation followed by a forward rotation. Backward rotation considers elements lying in the plane formed by joining indices [0][0][0], [N-1][0][N−1], [N−1][N−1][N-1], and [0][N-1][0]. Similarly, for Forward rotation elements lying in the plane formed by joining indices [N-1][0][0], [0][0][N−1], [0][N−1][N-1], and [N−1][N-1][0] are considered. The starting points for Backward and Forward rotations are [0][0][0] and [N-1][0][0], respectively. Rotation by K = 1 in a 3 x 3 x 3 array changes the content.

What I have tried:

tried all sorts of arrays and algorithms.
C++
```#include<iostream>
using namespace std;

class node
{
public:
int data;
node* next;
node* prev;
};

void print()
{
while(p!=NULL)
{
cout<<p->data<<" ";
p=p->next;
}
}
node* pushtail()
{
int data;
cin>>data;
node* newnode=(node)malloc(sizeof(node));
newnode->data=data;
newnode->next=NULL;

{
newnode->prev=NULL;
}
else
{
while(p->next!=NULL)
p=p->next;

p->next=newnode;
newnode->prev=p;
}

}

{
int data;
cin>>data;
node* newnode=(node*)malloc(sizeof(node));
newnode->data=data;
newnode->prev=NULL;

}

int main()
{
int n,data;
cin>>n;

for(int i=0;i```
Posted
Updated 18-Sep-22 19:51pm
v3
Patrice T 19-Sep-22 1:40am
Patrice T 19-Sep-22 1:46am
Use Improve question to update your question.
jeron1 19-Sep-22 10:12am

## Solution 1

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]

And by the way ... it may be urgent to you, but it isn't to us. All that your stressing the urgency does is to make us think you have left it too late, and want us to do it for you. This annoys some people, and can slow a response.