Skip to content

Instantly share code, notes, and snippets.

@joaogui1
Last active July 3, 2016 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joaogui1/e52872a938d68842b4ef668c652f3ba8 to your computer and use it in GitHub Desktop.
Save joaogui1/e52872a938d68842b4ef668c652f3ba8 to your computer and use it in GitHub Desktop.
//ler as entradas de uma matriz
int n, G[1000][1000];
for(int i = 0; i < n; ++i){ //Temos O(n*custo do for interno)
for(int j = 0; j < n; ++j){ //Termos O(n*operação do for)
cin >> G[i][j]; //O(1)
}
}
//Assim a complexidade é O(n*O(n*(O(1)))) = O(n^2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment