Tagged Questions
1
vote
3answers
79 views
Sorting 2D-array as a whole
I have a 2D array to sort as a whole using Java.
I have looked at the various links
How to sort a two-dimension ArrayList using comparators.
But it always sorts on a specific element. I want to ...
1
vote
2answers
180 views
2D Array neighboring algorithm
I have a 2D array like this:
0,1,0,0,1
1,0,1,0,1
0,1,1,0,1
0,1,0,1,1
1,1,0,0,1
If we extract the coordinates of all the 1's we get:
(height,width)
1,2
1,5
2,1
...
So now I want to find the ...
-1
votes
2answers
74 views
Reversi like game detect color diagonally (any help?) [closed]
I am recreating the classic Reversi game but I am having trouble on trying to correctly change colors diagonally. I have two for loops but they are not working correctly can anyone have a look at my ...
0
votes
1answer
54 views
Prind index of 2D Array using the click event
The code below display the index of each button when clicked the buttons are in an array but all this is done in form load. But I want to do the same thing in the click event and not in the form load ...
-3
votes
1answer
112 views
Convert Arraylist into a 2d Array?
I Basically wanted to take an input and store it into a 2D Array called mat with a 3x3 size
so i tried taking an input string, convert them into char and then sotring them in an array list and this ...
-2
votes
2answers
55 views
Return the index of the max number in a 2d array of ints in Ruby [closed]
I am trying to return the max value of an array of arrays in ruby
for 1d array this works
arr = [99, 3, 14, 11, 1, 12]
position = arr.each_index.max
how can I achieve the same thing for ...
-2
votes
2answers
161 views
Converting single dimensional array to 2D array in c#
I am having two 1D array. I want to convert these 2 arrays as single 2D array.
My code is:
public Static void Main()
{
int[] arrayRow;
int[] arrayCol;
for (int i = 0; i < row; i++)
{
for ...
1
vote
2answers
69 views
How can I make a variable size 2d array point to (and represent) the starting address of a 1d array in c?
I'm trying to do something as followed
float* A = fill_float(); //in other words A is full
float aIn2D[n/p][n] = &A; //the 2d array should be able to alter the 1d
I tried the above but wouldn't ...
0
votes
3answers
529 views
JavaScript Multi-Dimensional Array
I have a Student, who is in many courses, which have many Modules for each course.
So far, I have got:
var myStudent = new MySchool.Student("Bart", "Simpson", "0800 Reverse", "Some Street", ...
1
vote
1answer
109 views
Multi-dimensional array pascal syntac error
i did this and its working slightly better, now i get the error:
45 / 44 matric.pas
Fatal: Syntax error, ) expected but const char found
It is probable because i am using pascal graph.
program ...
-1
votes
3answers
243 views
2-dimensional array, IF condition checking
I've came across a problem when coding with C++ 2D array.
Just a little question, what does the code below mean?
...
if(array[x][y] >= 9){
...
}
...
Does that mean when the sum of x and y of ...
0
votes
2answers
122 views
2-D Array (row and column)
The program below (thanks to Sundial) computes the area of a rectangle
public class ComputeTheArea {
public static int areaOfTheRectangle (char[][] table, char ch) {
int[] first = new int[2];
...
-3
votes
7answers
222 views
2-Dimensional Array [closed]
We are given an assignment regarding 2-D array which states:
Please help me come up with an algorithm. I am new in Java and I'm having a hard time thinking of a pseudocode/code. All I know is
...
1
vote
6answers
313 views
Two-dimensional C array [closed]
I'm making a four in a row app, or, at least a class which calculates the best moves and stuff. The game board has a height of 6 and a width of 7. I'm not sure if I should name the instance variable ...
0
votes
2answers
809 views
Get the Rows and Columns from a 2D array matrix in Java
Suppose that I have a 2D array (matrix) in Java like this...
int[][] MyMat = {{0,1,2,3,4}, {9,8,7,6,5}};
If I want to extract the columns, I can do it easily like this...
int[] My0= MyMat[0]; ...