Write a function to print spiral order traversal of a tree. For below tree, function should print 1, 2, 3, 4, 5, 6, 7.
Recommended: Please solve it on “PRAC...
Share
Spiral model is one of the most important Software Development Life Cycle models, which provides support for Risk Handling. In its diagrammatic representation, it lo...
Share
Given a Binary Tree, convert it into Doubly Linked List where the nodes are represented Spirally. The left pointer of the binary tree node should act as a previous n...
Share
Given a binary tree containing n nodes. The problem is to find the maximum sum obtained when the tree is spirally traversed. In spiral traversal one by one all levels...
Share
Given a 2D array, print it in spiral form. See the following examples.
Examples:
Input:
1 2 3 4
5 6 7 8
9 10 11 12
...
Share
Given a 2D array, print it in counter-clock wise spiral form. See the following examples.
Examples :
Input:
1 2 3 4
5 6 7 8
9 ...
Share
Given a matrix of size n*m, and a point P(c, r). Print the matrix in a spiral form(clockwise) starting from the point P.
Examples :
Input : mat[][] = {{1 2 3},
...
Share
Given two values m and n, fill a matrix of size ‘m*n’ in spiral (or circular) fashion (clockwise) with natural numbers from 1 to m*n.
Examples:
Input : ...
Share
Given a 2D array, the task is to print matrix in anti spiral form:
Examples:
Output: 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
Input : arr[][4] = {1, 2, 3, 4
...
Share
Given a 2D array, print it in reverse spiral form. We have already discussed Print a given matrix in spiral form. This article discusses how to do the reverse printin...
Share