Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Programming question
#2
I don't really understand the question. In your example, the elements are already sorted, so what's the problem?

if you don't want to search the whole array, then you just need to find the 101 and 103 points, right?

you can do that very easily in a sorted array.

Look at the mid point, see if 101 is below or above.

Then look at the midpoint of that section, see where 101 is.

With this method you can find a number in a 1024 array in just 10 steps.

Repeat for 103.

Now you have your low and high limit, 101 and 103. Just copy the old array to a new array starting from the 101 element to the 103 element.

Is that what you wanted?

Sorry if I did not understand your question clearly.
Reply


Messages In This Thread
Programming question - by volcs0 - 01-14-2008, 01:45 AM
Re: Programming question - by space-time - 01-14-2008, 02:10 AM
Re: Programming question - by TheTominator - 01-14-2008, 02:20 AM
Re: Programming question - by volcs0 - 01-14-2008, 03:22 AM
Re: Programming question - by TheTominator - 01-14-2008, 06:45 AM
Re: Programming question - by volcs0 - 01-16-2008, 06:17 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)