|
Hi,
I need some help with my programming assignment.
Say i have an array of numbers like {-1,0,2,4,5,6,7}, i.e a total of 7 numbers starting from index 1 to 7. I need to find how many no.s have a value equal to their index.
In the above example 4 numbers have values equal to their indexes(they are 4,5,6,7 located in the 4th,5th,6th and 7th index positions respectively). My task is to first translate the above said array into an appropriate data structure and then using that data structure am supposed to find the solution and all this has to be done in O(log n) complexity. I am not sure how to get started with this assignment. I would really appreciate if some one could help me get started. Btw am also not supposed to use the JAVA API.
Thanks a million
This post has been edited by vvinod1310: 2 Sep, 2008 - 10:14 AM
|