Reduced complexity from O(N^3) to O((N^2)*Lg(N))