Spiral Algorithm in C# -


How can I fill an array like this:

  1 2 3 4 5 6 7 8 20 21 22 23 24 9 1 30 31 32 25 10 18 29 28 27 26 11 17 16 15 14 13 12 Spirals C # Thank You 

element starting with element (0,0) (top-left), and right (increase your column index). Keep a running counter that every time you fill an element, as well as the upper and lower limitations fill the rows and columns that you have to fill yet. For the M-line by the N-column matrix, your line limits must be 0 and (M-1) and your column has a limit of 0 and (N-1). Unless you obstruct your upper column, block your upper column, until you force your upper line, do not interrupt your upper line, leave it until you have your own Do not force the lower column, increase your lower column, go up until you obstruct your lower line, increase your lower obligation, and until your upper and lower punk End column borders is not your run of M * N to is not the same (or when) Repeat until then.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -