hi there can any one help me to answer this problem .

problem >
Imagine you are given a set of input elements where each element is assotiated with a specific access Probability by which each element is likely to be accessed ; e.g;

Elements :{A,B,D,K,L,M,N}
pi=<0.1,0.15,0.25,0.05,0.2,0.1,0.15> for all 1<=i<=n


How would you benefit from such information so that you minimize the search time ?

Recommended Answers

All 3 Replies

How would you benefit from such information so that you minimize the search time?

I'm trying to think of a way to point you in the right direction without just giving you an answer... what have you come up with so far?

i am thinking in sorting the element according to their probability .

That sounds like a good idea to me.

One thing to keep in mind is what search algorithm is being used. Sorting by access probability should work fine if it's "start at the beginning of the array and run through it until you find what you're looking for." You might have to adjust for different search algorithms--in general, you've got the right idea: put high-probability elements in places where the search looks first.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.