How to "quick search" in a sorted list ?

Hi all,
I need that your advice to choose the best collection to modelize my data.
Let me describe you the context of my problem:
I work on an antenna pattern file which looks like this:
Elevation (deg);Gain (dB)
0;5
3;45
6;3.1
10;6.5
16;18.1
20;33.1
24;31.2
30;3.5 I need, for a given elevation angle, to get the related gain. if the exact value of the angle is not found, we will return the gain of the nearest angle.
For example:
If the elevation angle is 5 degrees, I must return 3.1 dB.This operation should be called a big number of time (about many hundred calls)
What are your advices to modelize my data ? What is the best collection to do it ? What is the best way to quick search in this data to get the gain realted to a given angle ?
I though to use the binary search tree. What do you think about this solution ? Do you known of the Java API contains an implementation of the binary search trees ?
I though too to use an hashset. The hashcode should be computed in order to access to the nearest angle in the list of values. But I did not find the alogrithm to compute a such hash code. Maybe it is a wrong way.
Please, help me.
Tell me your opinion and your advices to solve my problem.
Let me know if you need more information
Thanks

OK, it works.
I created a class for my data:public class ElGainPatternElement
  private double elevation;
  private double gain;
+getters/setters
}Then, I created a comparator to compare my elements on the elevation attribute.
Finally, I specialiazed the Collections.binarySearch method in order to return the value instead of the index.
I the object is not found, I return the inferior (or superior) object.
public static <T> T binarySearch(List<? extends T> list, T key,
      Comparator<? super T> c, boolean isMinStrategy)
    int index = Collections.binarySearch(list, key, c);
    // si objet non trouv�
    if (index < 0)
      // r�cup�rer l'index le plus proche de celui recherch�
      index = isMinStrategy ? (-index - 2) : (-index - 1);
      // si plus grand que tous les �lts, retourner le dernier de la liste
      if (index >= list.size())
        index = list.size() - 1;
      // si plus grand que tous les �lts, retourner le premier de la liste
      else if (index < 0)
        index = 0;
    // retourner l'objet le plus proche au regard de la strat�gie
    return list.get(index);
  }It works very well.
But now, I need to change the strategy to use if the wanted elevation is not in the list.
If you look at the example of my first post, the 5 degrees of elevation is not in my list. So, I have to interpolate the values of the gain in order to get a correct gain.
If possible, it should use the least squares interpolation (I'm not sure of my traduction of "moindres carr�s").
I have really no idea of the way to do it.
Can anyone help me with this interpolation ? I have never use algorithm of interpolation (except the mean of 2 values).
Maybe the Java API provides some utilities that can help me to interpolate my values ... any suggestions ?
Thanks

Similar Messages

  • How to get sublists off a sorted list

    I'm using Arrays.sort(Object[], Comparator) to help sort some
    of my objects. However, I now have a need to create sublists
    off of a sorted list
    For example when I sort by last name ...
    SubList1: Clark, Stanley
    SubList1: Goodyear, Nancy
    Goodyear, Elvis
    Are there any Java APIs or some other techniques available to
    do this?
    I was thinking of using a Observer/Observable interface to notify
    a change in comparison key which could then be used to create
    sublists.
    Thanks in advance
    PJ

    java.util.List has a method subList

  • How do I search my posts sorted by date?

    Hi hussein,
    I am retrieving all my posts in this forum, and I got it sorted "alpha" , how can I sort it by date?
    Thanks
    MsK
    By the way, I saw that u have updated my last 2 posts, but when I clicked on them, I do not see your response yet,
    kinda weird? like the server is too slow?

    Hi,
    I am retrieving all my posts in this forum, and I got it sorted "alpha" , how can I sort it by date?I do not think you can sort by date, but you can click on your profile, then click on "Search for all user messages" and select the "Date Range".
    By the way, I saw that u have updated my last 2 posts, but when I clicked on them, I do not see your response yet,
    kinda weird? like the server is too slow?You will have to refresh the page, this usually happens to me after posting and I need to refresh the page to see the new update.
    Regards,
    Hussein

  • How to quickly find purchases and sort order of songs?

    I just purchased an entire album and some random songs from another artist. First of all, what's the quickest way to access my purchases? Nextly (word?) how do I customize the order of the tracks so I can burn a CD the way I want to?

    You have to make aplaylist in order to burn to a CD. Once you have the burn playlist, you can either sort by the columns, of if you have the little black triangle in the header row at the extreme left, you can drag tracks into any order you like.

  • Configuring Quick Search in Recruiter Work Center HCM_ERC_CI_2

    Greetings,
    I am trying to configure the quick search in the recruiter work center for business function HCM_ERC_CI_2.  I don't seem to be picking up candidates, requisitions or postings correctly.  For example, I search for "test".  I know that I have requisitions and postings that contain the word "test" in the title but I don't get any of those in the search results.  I've tried playing around with the V77RCF_SMG_NAVI settings and it doesn't seem to help.
    This is how I have things configured as of right now:
    V_T77RCF_SRCH_C   quicksearch, enable ranking , display max hits 50, display threshold 50.00
    V77RCF_SMG_NAVI   quicksearch, 22, Fast Search
    V_T77RCF_SMG_ASM   1,96, Fast Search
    V_T77RCF_SM_ASME   no entries (all entries are related to candidate information?)
    Can some please advise how the quick search should be configured?
    Thanks,
    Laura

    I assume that I am missing a piece of key configuration in the search profile or search templates. 
    In V_T77RCF_SMASK, entry 96 Fast Search is of type Full Text and the search profile is INT_CAND.  This leads me to believe that only candidate data is being searched.  However, when I tried to change it to ERC_REQ I am still getting only candidates.
    I have tried the various reports COM_SE_SEARCH_TEST, COM_SE_SEARCH_IIF_TEST, COM_SE_SEARCH_ATTRIBUTES and I don't understand how to interpret them.

  • How do prevent HTML snippets from being listed on search engines?

    I just created a new website using iWeb 3.0.1. On a couple of my pages I embedded flash music players and video players using the HTML Snippet widget. I did a quick search of my website on google and noticed that the HTML widgets were showing in the results as separate pages. I then clicked on these HTML Snippet pages and up came the widget on a separate page by itself. How do I prevent search engines from listing any HTML Snippets on my iWeb site as separate pages?
    Thanks
    athafran

    Paste this in the HTML Snippet.
    In the <body> ... </body> part you paste the code you currently use for your Snippet.
    I haven't tried it, the noindex part, but the code itself is accepted by iWeb.
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="robots" content="noindex,nofollow">
    <meta name="description" content="instructions for excluding search engine robots">
    <title>Search Engine exclusion</title>
    </head>
    <body>
    Here your current code.
    </body>

  • Quick Searches sort algorithm

    Hello,
    I'm defining some Quick Search queries to be used in Agent Inbox (through SAP Menu>Interaction Center>Administration>Agent Inbox>Define Quick Searches (CRMC_IC_AUI_QUICKS)
    There is field for defining 'Special Sort' for search results which can be used to define sort algorithm in addition to default options.
    My question is, how can I define sort algorithm? I think it is some xml algorithm but I have no idea how? Does anyone have any examples?
    Thanks,

    Hi John,
    Thanks for your response. I saw page 48 in the Inbox FAQ doc. It does talk about method for Custom sort by doesn't say anything about how?
    I need more details. Someone mentioned that we can write xml sort queries in Custom sort field but I'm looking for more information on how it can be done.
    Thanks,

  • Assigned To column not working in the quick search of a list

    Hi, I have a list where we have a column called Assigned To, but it is a single line of text column type. Search is working since I am able to find other values in the list.
    Now, when using the quick search, it is not working or showing results in this column.
    Could this be related that this column is a manage metadata column type as default in SharePoint?
    I have created a new list with this value but, as person column type and it is not working either.
    Any ideas?

    Hi Javi,
    Please check and make sure your custom "Managed Property" map to the crowed property generated by managed metadata column, and set the manged property as "Searchable" then start an incremental crawl or full crawl.
    For "Assigned To" column(e.g. crawled property should be "ows_Assigned_x0020_To"), I enabled the "Searchable" option for the manged property, then start an incremental crawl, and then search the
    user in "Find an item" and it worked, you can try.
    Thanks
    Daniel Yang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to enable enable Quick Edit button in Discussions List (SharePoint community).

    I wonder how I can enable the Quick Edit button in Discussions List (SharePoint community), see attachment. This is no problem on other list in SharePoint. I need to import data that I have in a Excel sheet from and old forum (not Sharepoint). So if I can
    enable Quick Edit, I will just copy data into my Discussions List. Hope somebody can help me???

    Hi,
    Please execute the commands below to enable Quick Edit feature in Discussion board list:
    $web = get-spweb "http://sp/sites/sitename"
    $list = $web.Lists["listname"]
    $list.DisableGridEditing = $false
    $list.Update()
    Now you could use Quick Edit in Management view.
    Regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected] .
    Rebecca Tu
    TechNet Community Support

  • How to add a Quick Search Region of the shuttle

    JHeadstart 10.1.3.1.26
    Help me! Help me! Help me!
    How does add a Quick Search Region of the shuttle
    http://cid-857a1e2135747b0c.spaces.live.com/?_c11_PhotoAlbum_spaHandler=TWljcm9zb2Z0LlNwYWNlcy5XZWIuUGFydHMuUGhvdG9BbGJ1bS5GdWxsTW9kZUNvbnRyb2xsZXI%24&_c11_PhotoAlbum_spaFolderID=cns!857A1E2135747B0C!112&_c11_PhotoAlbum_startingImageIndex=&_c11_PhotoAlbum_commentsExpand=&_c11_PhotoAlbum_addCommentExpand=&_c11_PhotoAlbum_addCommentFocus=&_c=PhotoAlbum
    Message was edited by:
    user589457

    JHeadstart 10.1.3.1.26
    Help me! Help me! Help me!
    How does add a Quick Search Region of the shuttle
    http://cid-857a1e2135747b0c.spaces.live.com/?_c11_PhotoAlbum_spaHandler=TWljcm9zb2Z0LlNwYWNlcy5XZWIuUGFydHMuUGhvdG9BbGJ1bS5GdWxsTW9kZUNvbnRyb2xsZXI%24&_c11_PhotoAlbum_spaFolderID=cns!857A1E2135747B0C!112&_c11_PhotoAlbum_startingImageIndex=&_c11_PhotoAlbum_commentsExpand=&_c11_PhotoAlbum_addCommentExpand=&_c11_PhotoAlbum_addCommentFocus=&_c=PhotoAlbum
    Message was edited by:
    user589457

  • How do I disable/uninstall "Quick Search" in Status Bar?

    I want to disable/uninstall the "Quick Search" box that pops up in my Status Bar in Firefox 23.0.1 Right now I'm having an issue with an "erratic cursor" (Windows 8...YUCK!!!!). I start typing in the address bar in a new tab, or in Google search bar, and my cursor floats all over the screen without my knowledge. In the middle of typing my search, the cursor will somehow "trigger" the "Quick Search" box, and suddenly, my words end up being typed there. I found out that this "erratic cursor" is a documented issue with the Lenovo G585 laptop, and until I find out how to fix it, I REALLY want to stop "Quick Search" from opening unless I ask it to open.
    How do I stop "Quick Search" from opening?
    Thanks in advance for your help!
    Nuts4Mutts :)

    Have you seen the articles below.
    * [[Disable or remove Add-ons]]
    AND
    * [[Troubleshoot Firefox issues caused by malware]]
    Please follow all the instructions on the page.

  • How do I disable the "Quick Search" feature?

    I don't need or want the Quick Search function on Firefox. Simply deleting the Quick Search bookmarks folder doesn't get rid of it because it automatically reappears as soon as I restart Firefox. How do I disable this feature altogether?

    Here's what worked for me.
    Right click in the toolbar area to get the toolbar customization menu. That is, right click just to the right of the "Help" button on the Menu Bar.
    You'll see:
    Menu Bar,
    Navigation Toolbar,
    Bookmarks Toolbar
    These three may or may not have check marks, but you want to click on the fourth item, below the line, "customize".
    Left click the customize button and the "customize toolbar" window appears. Click and hold the "quick search" and drag it into the customize window and release. Quick search should settle itself into the customize toolbar window, patiently waiting if you ever decide you might want it again. : )
    L. Smith
    screen captures by SnagIt

  • How to uninstall quick search from mac air

    How to uninstall  "quick search"  from mac air

    Check for Safari extensions in the menu Safari - Preferences - Extensions. Uninstall any you don't want. Check your home page and search preferences on the main Preferences screen.
    If symptoms persist, try running AdwareMedic.
    http://AdwareMedic.com
    Matt

  • Quick search no longer searches on parts of words, only whole words. How do I fix this?

    Quick search no longer searches on parts of words, only whole words. So for Example, if I were normally searching for my colleague with the last name of chadwick, I would type c then h then a then d until the list on left chadwick. Now, when I do a search on "chadw" nothing comes up and i have to type in the full word or name. I am a victim of one of these recent "upgrades" I guess.

    Never mind. It was because I had the search set to searching the body of all the messages.

  • How do I safely download google quick search box?

    Can anyone tell me, how do I safely download Google Quick Search Box?

    I'd likely use Spotlight or the google widget in Dashboard, although I usually stick with highlighting a word to search for, then ctrl-click & pick 'search with google'.
    QSB development seems to have ceased in 2010, and it was still 'beta' software then.
    http://www.alfredapp.com/ seems popular with some, and is in the app store.

Maybe you are looking for

  • Under Settings Cellular "use cellular data for" apps are missing from Iphone 4

    After updating to IOS 7, my wife's iPhone 4 under the "use cellular data for"  only has Passbook and System Services. My son's iphone 4 and my iPhone 4s DO HAVE this option avl. and show all our Apps. Any ideas out there? Thanks

  • How can i dynamically select columns based on the input parameter?

    I have an input parameter which takes single numeric value. Based on this value i have to dynamically select table-columns . For eg: if i have following fields in my table : SEM_1 SEM_2 SEM_3 and SEM_4. And if i give numeric input as 2 , then i have

  • Adobe Acrobat X Pro is incompatible with Windows 8.

    I have tried on a number of occasions to launch Adobe Acrobat X Pro on Windows 8 but there appears to be an incompatability problem. Any advice on how this can be addressed?

  • Firefox does not load web pages but gives no error message

    Hi guys, I have been having this problem occasionaly for the past few weeks and can't remember making any changes to my computer or firefox that would have prompted it. Basically what happens is that when I try to load a web page, it says "loading...

  • PO ACCRUALS AND ACCOUNTING에 관해 자주하는 질문과 답변

    제품 : MFG_PO 작성날짜 : 2004-02-11 PO ACCRUALS AND ACCOUNTING에 관해 자주하는 질문과 답변 ========================================== PURPOSE PO를 생성하고 Receipt를 하는 과정에서 Accruals Accounting이 발생하게 되나 이 Accruals Accounting의 의미를 정확히 모르는 경우가 많다. 이 note를 통해 Accruals Accounti