|
|
вернуться в форумDid the problem without using binary search. However it takes 0.109 seconds. The main method I followed was to first compare two of the arrays and extract the similar values in another array. I then compared that array with the third array, and updated the counter each time there was a match in eigenvalues. This method avoids comparing all the arrays together, and hence takes up less time. So in essence number of operations reduces to O(2*N^2) instead of O(N^3). However, more sophisticated algorithms like binary search are more effective. But still I include this method for people like myself, who are new to algorithms. Hope it helps someone. Re: Did the problem without using binary search. However it takes 0.109 seconds. Послано Zteeks 20 дек 2016 22:28 Thank you! Did as you said and get Accepted)) 0.046 seconds (FreePascal) |
|
|