Within a sparse-array data-structure how does one retrieve the real position count of such a structure's item?

I have a sparse array of array entries/items as follows …

var indexed = new Array();

indexed["5"] = [35, 2];
indexed["3"] = [20, 2];
indexed["4"] = [25, 3];

I want to find something like the "real" position count of an entry/item within such a sparse array structure by providing an item’s array index( respectively its key).

Expected results:

  • If one does provide 3 (either as string or number value) the returned (index) value should be the number value 0.
  • If one does provide 4 (either as string or number value) the returned (index) value should be the number value 1.
  • If one does provide 5 (either as string or number value) the returned (index) value should be the number value 2.
  • In case of an unsuccessful search the return value should be the number value -1.

179 thoughts on “Within a sparse-array data-structure how does one retrieve the real position count of such a structure's item?”

  1. Right here is the right website for anyone who hopes to find out about
    this topic. You understand so much its almost tough to argue with you (not
    that I really will need to…HaHa). You certainly put a fresh
    spin on a topic that has been written about for decades.
    Wonderful stuff, just great!

    Reply
  2. Hello! This is my 1st comment here so I just wanted to give a
    quick shout out and tell you I genuinely enjoy reading your articles.

    Can you suggest any other blogs/websites/forums that deal with the
    same subjects? Thanks!

    Reply
  3. Right here is the right webpage for everyone who really wants to understand this topic.
    You realize a whole lot its almost hard to argue with you
    (not that I personally would want to…HaHa).

    You certainly put a fresh spin on a topic that has
    been written about for years. Great stuff, just excellent!

    Reply
  4. Do you mind if I quote a few of your articles as long as I provide credit and sources back to your weblog?
    My website is in the exact same niche as yours and my
    visitors would genuinely benefit from a lot of the information you provide here.
    Please let me know if this ok with you. Regards!

    Reply
  5. Hi there, I discovered your website by way of Google at the same
    time as searching for a comparable matter, your site
    got here up, it appears to be like great. I have
    bookmarked it in my google bookmarks.
    Hi there, simply was aware of your blog through Google, and
    located that it is really informative. I am going to watch out for brussels.

    I will be grateful in the event you continue this in future.
    Lots of other folks will be benefited from your writing.

    Cheers!

    Reply
  6. My spouse and I absolutely love your blog and find most of your post’s to be exactly I’m looking for.
    Would you offer guest writers to write content for
    yourself? I wouldn’t mind composing a post or elaborating
    on many of the subjects you write in relation to here. Again, awesome web site!

    Reply
  7. I don’t even understand how I ended up here, however
    I thought this submit used to be good. I don’t know who you might be
    however certainly you are going to a well-known blogger in case you
    aren’t already. Cheers!

    Reply
  8. I blog frequently and I truly thank you for your information.
    Your article has truly peaked my interest. I am going to take a
    note of your blog and keep checking for new information about once per
    week. I opted in for your Feed as well.

    Reply
  9. My spouse and I absolutely love your blog and find the majority of your
    post’s to be what precisely I’m looking for. Would you offer
    guest writers to write content available for
    you? I wouldn’t mind writing a post or elaborating on some
    of the subjects you write related to here. Again, awesome
    weblog!

    Reply
  10. Hey just wanted to give you a quick heads up. The text
    in your content seem to be running off the screen in Chrome.

    I’m not sure if this is a format issue or something to do with
    internet browser compatibility but I figured I’d post to let
    you know. The style and design look great though! Hope you get the problem solved soon. Kudos

    Reply
  11. You really make it seem so easy with your presentation but
    I find this matter to be actually something that I think
    I would never understand. It seems too complex and extremely broad for me.
    I am looking forward for your next post, I’ll try to get the hang of it!

    Reply
  12. Heya excellent website! Does running a blog such as this
    require a large amount of work? I’ve absolutely no knowledge of programming but I had been hoping to
    start my own blog in the near future. Anyway, should you have
    any recommendations or tips for new blog owners please share.
    I know this is off subject however I just had to
    ask. Many thanks!

    Reply
  13. A person necessarily help to make significantly posts I would state.
    That is the very first time I frequented your website page and so far?
    I amazed with the analysis you made to create this actual
    submit amazing. Fantastic job!

    Reply
  14. Can I simply say what a relief to discover someone that genuinely understands what they’re discussing on the net.
    You actually understand how to bring an issue to light and make
    it important. A lot more people need to look at this and understand this side of the story.
    I was surprised you aren’t more popular because you definitely have the gift.

    Reply
  15. Right here is the right webpage for anybody who really wants
    to understand this topic. You realize a whole lot its almost hard to
    argue with you (not that I really would want to…HaHa).
    You definitely put a brand new spin on a subject
    which has been discussed for a long time. Great stuff, just wonderful!

    Reply
  16. Oh my goodness! Amazing article dude! Thank you, However I am experiencing difficulties with your RSS.
    I don’t know why I can’t join it. Is there anyone else getting similar RSS problems?
    Anybody who knows the solution will you kindly respond?
    Thanx!!

    Reply
  17. Great beat ! I wish to apprentice whilst you amend
    your web site, how could i subscribe for a blog web site?
    The account helped me a applicable deal. I have been a
    little bit acquainted of this your broadcast offered vivid transparent idea

    Reply
  18. Have you ever thought about including a little bit more than just your articles?
    I mean, what you say is important and everything. Nevertheless just
    imagine if you added some great graphics or videos to give your posts more, “pop”!
    Your content is excellent but with images and video clips,
    this site could definitely be one of the greatest in its niche.
    Fantastic blog!

    Reply
  19. Hey there I am so happy I found your website, I really found
    you by mistake, while I was researching on Yahoo for something else,
    Anyways I am here now and would just like to say kudos for a tremendous post and
    a all round exciting blog (I also love the theme/design), I don’t have time to browse it all at the minute but I
    have book-marked it and also added your RSS feeds, so when I have time I will be back to
    read a great deal more, Please do keep up the great work.

    Reply
  20. Appreciating the commitment you put into your site and detailed information you
    offer. It’s great to come across a blog every once in a while that isn’t the same outdated rehashed material.
    Fantastic read! I’ve saved your site and I’m adding your RSS feeds to my Google account.

    Reply
  21. You actually make it seem so easy with your presentation but
    I find this matter to be really something that I
    think I would never understand. It seems too complex and very broad for me.
    I’m looking forward for your next post, I’ll try to get the hang of it!

    Reply
  22. Excellent post. I was checking constantly this
    blog and I am impressed! Extremely useful information specifically the last part 🙂
    I care for such information a lot. I was looking for this
    certain info for a very long time. Thank
    you and good luck.

    Reply
  23. When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several emails with the same comment.

    Is there any way you can remove people from that service?

    Thanks a lot!

    Reply
  24. Today, I went to the beach with my kids. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She
    put the shell to her ear and screamed. There was a hermit crab inside and it
    pinched her ear. She never wants to go back! LoL I know this is
    totally off topic but I had to tell someone!

    Reply
  25. Hey there! I understand this is somewhat off-topic however I had to ask.
    Does managing a well-established website such
    as yours require a large amount of work? I’m completely new to operating a blog but I do write in my diary on a daily basis.
    I’d like to start a blog so I can share my own experience and feelings online.
    Please let me know if you have any recommendations or
    tips for brand new aspiring blog owners. Thankyou!

    Reply
  26. I’m really loving the theme/design of your blog.
    Do you ever run into any browser compatibility problems?
    A number of my blog audience have complained about my site not working correctly in Explorer
    but looks great in Safari. Do you have any
    advice to help fix this problem?

    Reply
  27. I loved as much as you will receive carried out right here.
    The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get bought an impatience over that you wish be delivering the following.
    unwell unquestionably come more formerly again as exactly the same nearly very often inside case you shield
    this increase.