+ 6

Array and matrix

What is an array and what is a matrix?

5th May 2017, 12:16 PM
Martin Möhle
Martin Möhle - avatar
4 Respostas
+ 8
Depending on context language, arrays ( sometimes named lists ) are not necessary holding a fixed number of value of a single type: JS Arrays, or Python List arre dynamical and not typed, meaning you can mix data type items inside them and you can change the number of items contained at run time, adding or substracting them ^^ "Matrix" is the mathemaical word for the same kind of data structure named 'Array' or 'List' in programming vocabulary, limited to numerical values, and coming with set of calculation rules helpful for improve complex mathematical calculation ;)
5th May 2017, 3:14 PM
visph
visph - avatar
+ 6
@Alvaro: oh! I didn't know that... my mathematical skills doesn't go as deeper ;P ( anyway, they cannot handle 'string' values ^^ )
5th May 2017, 4:20 PM
visph
visph - avatar
+ 3
An array is a container object that holds a fixed number of values of a single type. The length of the array is established at creation time and after this its length is fixed. A matrix is a two dimensional (or multiple dimensions) array which resembles a table with rows and columns. int [ ] [ ] scores = new int [ 4 ] [ 5 ]; Indicates that there will be four arrays of ints in the array scores with 5 ints on each array of ints.
5th May 2017, 12:25 PM
Coady91
Coady91 - avatar
+ 2
@visph: <little-off-topic> Mathematical matrices can hold more than numerical values, e.g. functions, submatrices, spaces... </little-off-topic>
5th May 2017, 4:18 PM
Álvaro