Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

# Efficient Search Algorithm

No replies to this topic

### #1 rboone2020

rboone2020

• Members
• 69 posts
• OFFLINE
•
• Local time:04:52 PM

Posted 22 February 2007 - 04:38 PM

Hi folks,

I've posted on BleepingComputer forums before and had great help. This is a little different,
but I thought I would give it a shot. I'm an ecologist modeling the movements of animals on
a landscape represented by pixels in a raster map. The animals need to select their favorite
pixel within a neighborhood of n x n pixels based on the values they store. I have no clever
algorithm for this, and don't know if one exists. Right now, an brute-force n x n search is used
to find the maximum value within the neighborhood of the animal.

One thought is to just use the brute-force approach in a pre-pass on the landscape, and store
the "destination" pixel for every pixel the animal may occupy. Then modeling would indeed be
fast, as distinations would be predetermined. But I include a random component in this modeling,
so that the animals movements aren't 100% predictable. In the search I describe above, that
just means assigning a random value to pixel values before doing the n x n search, which is
easy enough. But wanting to include some random component in the movements makes a
pre-pass troublesome.

So, does anyone know of an algorithm to identify the maximum pixel in an n x n block of
pixels that is faster than n^2?

Thanks for any help,
Randy Boone