/ Published in: Java
compare individual array elements with one another, without doing the same comparison twice (3vs2 then 2vs3). this reduces the number of iterations by roughly half. it's still O(n^2), an 1000 member array won't iterate a 1000X1000 times, it will be (1000X999)/2. efficient!!
an array of 0,1,2,3 will print out the following:
01,02,03,,12,13,2,3
ENJOY MY MATHS
an array of 0,1,2,3 will print out the following:
01,02,03,,12,13,2,3
ENJOY MY MATHS
Expand |
Embed | Plain Text