Re: Homework help - Algorithm complexity
This algorithm is an N^3 algorithm.
To get logarithm time, you need recursion so that you only hit a fraction of the total number of values. Tree data structures are good at getting logarithmic time.
For example, if you have 5 elements, you will only touch through 4 of them.
|