KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What's the efficiency (in Big O notation) of a simple program that traverses a 2D array of ints and outputs each element. Take the following code as an example: public static void main(String args[]) { int[] array = {{1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16}}; for(int i = 0; i < array.length; i++) { for(int j = 0; j < array[i].length; j++) { System.out.println(array[i][j]); } } }
Tags (comma-separated)
Save Edits
Cancel