0% found this document useful (0 votes)
2 views1 page

Vertical Spiral Traversal in Java

Uploaded by

Naik Anushka
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Vertical Spiral Traversal in Java

Uploaded by

Naik Anushka
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

int[][] arr = new int[3][5];

// arr[0][1] = 1;
// arr[0][2] = 2;
// arr[0][3] = 3;
// arr[0][4] = 4;
// arr[0][5] = 5;

// arr[1][1] = 6;
// arr[1][2] = 7;
// arr[1][3] = 8;
// arr[1][4] = 9;
// arr[1][5] = 10;

// arr[2][1] = 11;
// arr[2][2] = 12;
// arr[2][3] = 13;
// arr[2][4] = 14;
// arr[2][5] = 15;

// // Spiral Traversal - Vertical


// [Link]("\n\nGiven Array");

// for (int i = 0; i < [Link]; i++) {


// for (int j = 0; j < arr[0].length; j++) {
// [Link](arr[i][j]);
// [Link](" ");

// }
// [Link](" ");
// }

// // Spiral Traversal - Vertical


// [Link]("\n\nSpiral Traversal - Vertical");

// for (int j = 0; j < [Link]; j++) {


// if (j % 2 == 0) {
// for (int i = 0; i < arr[0].length; i++) {
// [Link](flats[i][j]);
// [Link](" ");

// }
// } else {
// for (int i = arr[0].length - 1; i >= 0; i--) {
// [Link](arr[i][j]);
// [Link](" ");

// }
// }

// }

You might also like