Solution # 1(a)
Whenever we calculate the time complexity of brute force algorithm we see that there are two accesses of array P in the out put statement. Instead, writing complete algorithm, the final output part of the code will work for the given problem:
We had output part in the Brute force Algorithm like below (we had two accesses).
Output P[i].x

For Complete solution plz check the attachment given below

Spring 2010_CS502--2.doc

Sponsored Links