Last active
August 12, 2019 07:46
-
-
Save YannMjl/0b2693aaffa82294acf8bb670bf8ce5b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // read an array of array | |
| function readArrayOfArray() { | |
| // This is an array of arrays. | |
| // It is a little easier to read like this: | |
| var arrayNumberFruit = [ | |
| [1, 'Orange'], | |
| [2, 'Banana'], | |
| [3, 'Apple'], | |
| [4, 'Mango'] | |
| ]; | |
| arrayNumberFruit.forEach(function (items) { | |
| // will display [1, 'Orange'], [2, 'Banana'],... | |
| console.log('Items in the array are: ', items); | |
| items.forEach(function (number) { | |
| // will display 1, Orange, 2, Banana, 3 ...... | |
| console.log('Numbers in the array are: ', number); // | |
| }); | |
| }); | |
| } | |
| // ********************************************************************************** | |
| // - In this case the run time of readArrayOfArray is quadratic: O( n²) | |
| // - the method goes as O(N*N) or O(N²), because every time you increase the number | |
| // - of items in the array of array, the computation effort or time will increase as | |
| // - the square of the number of points. | |
| // ********************************************************************************** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment