All Questions
Tagged with 2d multidimensional-array
184
questions
0
votes
0
answers
19
views
Array object vs array primitive in javascript acts differently when setting values [duplicate]
Running the below code leads to an unexpected result where all 0th indexes are set to 6
let arr = new Array(5);
arr.fill(new Array(3).fill(0)); // 5x3 array of all 0's
arr[0][0] = 6;
console.log(...
0
votes
1
answer
45
views
update multidimensional array in unity
I'm currently working on a match-3 game genre in the Unity engine, and I'm using some gem artwork for it. I've encountered a situation where, after storing the gem positions in a 2D array and swapping ...
0
votes
1
answer
69
views
why is this piece of code able to tell if a number in a 2D array has been repeated?
//checking validity of sudoku solution
bool validityCheck (int sudoku [25][25], int n, int sqrt_n) {
//checking rows validity
for (int i=0; i<n; ++i) { // i means place in column
...
1
vote
0
answers
33
views
Space Complexity of flattening 2d array
say, I'm flattening a 2d array and putting the values in a new array
would the space complexity be O(n * m) where n is the size of the outer array and m is the size of the inner array which would be ...
0
votes
1
answer
48
views
2 way binding ngmodel to a 2d array is giving undefined when dynamically populating the array
I want to use [(ngModel)] bound to a 2d boolean array as I have a nested ngFor loop in the html. I want to populate this array dynamically as data will be coming from database but as the html starts ...
0
votes
0
answers
39
views
Can't figure out how to put contents of txt file into 2d array
I'm working on a data structures and algorithms problem for a class I am taking.
I am asked to put the contents of a .txt file into a 2d array and find the lowest value and the number of times it ...
0
votes
0
answers
57
views
Draw a maze in Unity from 2D Arr
I'm creating a game for a game jam and i make a static maze.
The problem is that the maze isn't made the same as in the maze.
{ 1, 0, 1, 1, 1, 1, 1},
{ 1, 0, 0, 0, 1, 0, 1},
{ 1, 1, 1, 0, 0, 0, 1},
{ ...
0
votes
1
answer
61
views
What is the best practise when working with 2D arrays in C, if it exists?
Question: What is the best practise when working with 2D arrays in C, if it exists?
As far as I program in C I always get my mind confused whenever using 2D arrays would be convenient.
I like ...
0
votes
0
answers
253
views
How to find the maximum element in a column in a matrix and display the index(row number of the maximum element)?
I have a matrix of M rows and N columns. How do I find the maximum element in each column and display the index(i.e., the row number of the Maximum element)?
Ex: (Considering a 2x2 matrix)
Input:
1 5
...
0
votes
1
answer
276
views
Print 2D Array using JOptionPane dialog box
I already made the code and i can input values using the JOptionPane Input Dialog.
But the problem is when printing the ouptut of the 2d array it shows like this:
The output should be like this: (can ...
-1
votes
1
answer
2k
views
User Input in Two-Dimensional Array and print the sum of rows and sum of columns
Our assignment is to create a two-dimensional array. A 3 by 3, that computes the sum of data in row and sum of data in columns.
The output should be like this:
3 by 3 Array - Enter Matrix Elements.
...
-1
votes
2
answers
531
views
why I got parameter must be 2D array error when I used imread with grayscale image?
I got an error in feature.local_binary_pattern
I used imread(img_path, cv2.COLOR_BGR2GRAY) but it didn't fix it.
The images that I read is grayScale
THE FULL Error message:
Traceback (most recent call ...
0
votes
0
answers
32
views
Extend: 2D into 1D using extend function in python3
Merging 2D array in 1D array using extend function in python so what is the space complexity ?
0
votes
1
answer
126
views
unexpexted output in c++ 2D array
problem
i/o formats
sample test case
For a given two-dimensional integer array/list of size (N x M), print the array/list in a sine wave order, i.e, print the first column top to bottom, next column ...
1
vote
2
answers
232
views
2d array average and total c++
it has to appear like this:
#include <iostream>
using namespace std;
int main()
{
float allsales[3] [2] = {{1200.33, 2350.75}, {3677.80, 2456.05}, {750.67, 1345.99}};
float ...