big o - Big-Oh Notation problem -


i think big-o notation n^2, im not sure.

for (int = 0; < n -1; i++) {     (int j = 0; j < n – 1; j++)         if (x[j] > x[j+1]) {             temp = x[j];             x[j] = x[j+1];             x[j+1] = temp;         } } 

you doing n * (n * (4)) operations = o(n^2)


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -