Questions tagged [spiral]

A spiral is a two- or three-dimensional shape composed of lines which continuously wrap around a center point. The spiral model is an iterative software development methodology, in which each iteration builds upon previous work.

202 questions
-2
votes
2 answers

spiral matrix using c program

I have written a program to print the matrix in the spiral form, but it only works for 3*3. how to make it useful for all the dimensions. #include #include void main() { int i,j,k=1,l=0; int n; clrscr(); …
Kuppo
  • 517
  • 1
  • 4
  • 10
-2
votes
1 answer

how to convert code into recursion?

import java.awt.Graphics; import javax.swing.JComponent; import javax.swing.JFrame; public class DrawIt { public static void main(String[] args) { JFrame frame = new JFrame(); final int width = 400; final int height…
abcd248
  • 31
  • 1
  • 5
-2
votes
3 answers

How can i get the spiral direction number

How can i get the spiral direction number of below image by javascript How can i get the spiral direction number of above image by javascript or jquery please help me I hope get the index number of 2d array by spiral direction I hope get the…
subzero
  • 61
  • 1
  • 9
-3
votes
1 answer

ArrayIndexOutOfBounds. Java Spiral Program

I keep getting the error ArrayIndexOutOfBounds: 4 on line 21. The line is Spiral[VIndx][HIndx]=number. This program is supposed to create a spiral of numbers when given a certain dimension. For example, if given the dimension 3, a 3x3 2d array that…
Patrick Jean
  • 45
  • 1
  • 3
  • 7
-4
votes
1 answer

How to do Alphabetic Spiral in python?

-- THE QUESTION -- Input : 3 Output : A B C H I D G F E Input : 5 Output : A B C D E P Q R S F O X Y T G N W V U H M L K J I -- My progress: -- print("input :") n = int(input()) alphabet= 65 for i in range(n): print((n+i)*" ") for j…
Udin
  • 1
  • 1
-5
votes
1 answer

grid traversal question

Possible Duplicate: Looping in a spiral Given a grid of any height and width, write an algorithm to traverse it in a spiral. (Starting at the top left and ending in the middle) without passing over previously visited nodes. Without using nested…
Mahdi Yusuf
  • 19,931
  • 26
  • 72
  • 101
-7
votes
3 answers

Square Spiral Co-ordinate

I want to find if a point (x,y)where x,y integers satisfy the spiral square. (0,0) (0,1) (1,1) (1,2) (0,2) (-1,2) (-2,2) (-2,1) (-2,0) ans so on..... How do I do it? I want the logic for a java or c++ function.
vis
  • 23
  • 5
1 2 3
13
14