Questions tagged [ragged]

A ragged array (or jagged array) is an array of arrays. The elements of a ragged array can be of different dimensions and sizes.

https://en.wikipedia.org/wiki/Jagged_array

78 questions
-3
votes
3 answers

How to write a method that returns true if no row is longer than a preceding row, otherwise false?

Say, if I have a 2D array: int[][] s = {{1, 4, 5, 10, 11}, {2, 6, 8}, {3, 9, 12}, {7}}; and I want to write a method that makes sure the next row has a shorter length than the rest of the array how would I go about doing so? Basically how would…
-3
votes
2 answers

How to create a ragged array in Java

I wanna create a ragged array (two-dimensional array) that the user inserts the values one at a time. I would usually create them like so: int[][] array = {{1,2,3}, {6,7}} but I don't know their size beforehand. How can I create an array like that?
-5
votes
1 answer

How to read a file in R where each line is a vector of variable length ('ragged')

I want to read a file that contain many vector for example you can see below 8984 8813 8685 11629 c(8527, 11629) c(8527, 7685, 7822, 11629) c(8527, 7685, 7822, 7137, 7318, 11629) c(8527, 7685, 7822, 7137, 7318, 7063, 7075, 11629) c(8527, 7685,…
1 2 3 4 5
6