How do I search someone on polyvore?

Can someone help explain this programming problem on interpolation search please!?

  • Write a program for interpolation search. Use interpolation technique 3 times at most, and recalculate the value of slope taking the new found value as one end point. Then perform linear search to the left if the value being searched is less than the value at the index you got by interpolation search. If the value being searched in more than the value at the index then perform linear search to the right until you hit the number. Use the sorting program from Problem # 2 to sort the data for interpolation search. I'm working on the problem above but I'm confused on what exactly to do. I'm a little confused as to how interpolation search works as well. If someone could explain some of this to me I would appreciate it. I already have the search program done that it says to use from problem #2 so i'm good with that part.

  • Answer:

    Lets start with interpolation search. It's a very cleaver algorithm that searches a sorted list in the same way you would search a dictionary or the yellow pages. If I asked you to search for the word "yellow" in the dictionary, you would naturally go to about 25/26 * # pages. This is interpolation search and it is defined the formula: lookat = low + ((toFind - sortedArray[low]) * (high - low + 1)) / (sortedArray[high] - sortedArray[low]) 0) So, you start with low = 0 and high = sortedArray.length - 1 1) Calculate lookat 2) If sortedArray[lookat] == toFind, you're done 3) If toFind < lookat, set high = lookat - 1, otherwise low = lookat + 1 4) If this is your 4th time here, goto (5), otherwise goto (1) //Don't actually use goto 5) Low and high are set appropriately because of (3), for(i = low; i < high; i++) check sortedArray[i]==toFind If you still need help, I'll come back later and give parts of the code, but hopefully this is enough. Good luck.

Bob at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.