Give an O(n) algorithm that sorts the array A using O(1) storage, i.e. can’t use a temporary array for storage

You are given an arrayA[1..n] of numbers and an integer m<n. The numbers in the sub-arrays A[1..m] and A[m +1..n]are (individually) sorted. As example, consider the array [1,5,7,8,11,2,3,4,10] the underlined numbers indicate the two sub-arrays (here m = 5 ). Give an O(n) algorithm that sorts the array A using O(1) storage, i.e. can’t use a temporary array for storage.

yes with o(1) storage
there is algo.
compare first and m+1element if m+1 th element is small then swap else compare second with m+1 increment ptr of second arr if swapped on continuing this way we can get sorted arr with o(n) complexity


210 Responses to “Give an O(n) algorithm that sorts the array A using O(1) storage, i.e. can’t use a temporary array for storage”

  1. scrapebox says:

    You’ll find nothing touches our imagination so much as a beautiful woman in a plain dress. -Joseph Addison

  2. runescape says:

    Thanks for your posting. One other thing is when you are selling your property alone, one of the issues you need to be alert to upfront is just how to deal with home inspection records. As a FSBO home owner, the key concerning successfully switching your property and saving money in real estate agent income is awareness. The more you already know, the more stable your property sales effort will likely be. One area that this is particularly critical is information about home inspections.

  3. Hi – in fact great site you’ve got created. I enjoyed scanning this posting. I did so would like to create a remark to tell you the model of necessary . is very aesthetically delightful. I’d been a designer, now i’m a duplicate editor. We have always enjoyed functioning with information processing systems and am learning code during my down time.

  4. Security Tool Removal is easy. The new Zune browser is surprisingly good, but not as good as the iPod’s. It works well, but isn’t as fast as Safari, and has a clunkier interface. If you occasionally plan on using the web browser that’s not an issue, but if you’re planning to browse the web alot from your PMP then the iPod’s larger screen and better browser may be important. security tool virus

  5. I appreciate your wordpress web template, where did you get a hold of it from?

  6. Thanks for some other excellent article. Where else may just anyone get that kind of info in such a perfect approach of writing? I have a presentation next week, and I’m on the search for such info.

  7. Are you experiencing it yet?

  8. Its pretty cool what blogging are capable of doing. Connect you with all others.

  9. What i do not realize is if truth be told how you are now not really a lot more well-liked than you may be now. You are so intelligent. You understand thus significantly in relation to this subject, made me in my opinion believe it from so many various angles. Its like men and women are not interested unless it’s one thing to accomplish with Woman gaga! Your personal stuffs excellent. Always maintain it up!

  10. I’m commenting to let you be aware of what a superb discovery my girl experienced visiting the blog. She figured out such a lot of details, including what it’s like to have a very effective helping nature to make the mediocre ones completely grasp various tortuous matters. You truly did more than visitors’ expectations. Thank you for rendering these invaluable, trusted, edifying not to mention cool thoughts on the topic to Julie.

  11. Mistakes are a part of being human. Appreciate your mistakes for what they are: precious life lessons that can only be learned the hard way. Unless it’s a fatal mistake, which, at least, others can learn from.

  12. cool thanks for Reisadvies sharing! btw exist feeds for your blog? I’d like to add these to my reader Finnaly i discovered your postkeep blogging Damn ! I just found a blunder inside your website! Find out if css is managed right!

  13. Thank you for another fantastic post. Where else could anyone get that kind of info in such an ideal way of writing? I’ve a presentation next week, and I’m on the look for such info.

  14. Dear Bruno Mars Can I borrow some of your views for my original songs Remember and Never Stop Believin I dont think you need them all hehe Thumbs up if you wanna help a little dreamer xoxo CC

  15. Naturally, what fantastic blog and instructive posts, I most certainly bookmark your blog.All the Best!

  16. I’ve recently started a website, the info you offer on this website has helped me tremendously. Thanks for all of your time & work. “A physicist is an atom’s way of knowing about atoms.” by George Wald.

  17. scrap a car says:

    I’m not that much of a internet reader to be honest but your sites really nice, keep it up! I’ll go ahead and bookmark your site to come back down the road. Cheers

  18. The other day, while I was at work, my sister stole my apple ipad and tested to see if it can survive a twenty five foot drop, just so she can be a youtube sensation. My apple ipad is now broken and she has 83 views. I know this is completely off topic but I had to share it with someone!

  19. Hi! This post couldn’t be written any better! Reading through this post reminds me of my old room mate! He always kept talking about this. I will forward this page to him. Pretty sure he will have a good read. Thanks for sharing!

  20. Given that men and women alike are afflicted with the skin illness known as cellulite, both genders look for the most prevalent solution to this problem and one of which is liposuction surgery. This is a surgical procedure that works well in getting rid of excessive fat within the body. Nonetheless, this could be painful, can cause certain side effects, costly and will not ensure the full elimination of the cause of the disease. Therefore, it’s best that you deal with your cellulite first with natural options.

  21. George Deats says:

    Hi there I am so delighted I found your weblog, I really found you by mistake, while I was browsing on Askjeeve for something else, Regardless I am here now and would just like to say cheers for a marvelous post and a all round interesting blog (I also love the theme/design), I don’t have time to go through it all at the moment but I have saved it and also added in your RSS feeds, so when I have time I will be back to read much more, Please do keep up the fantastic job.

  22. Han Trivedi says:

    Loving the information on this internet site , http://www.softride.com/member/6136/ you have done great job on the content .

  23. You’ve made quite a few significant points. I don’t know if we see eye to eye on everything, but then again, who does? I have to explore it more. Nice article anyhow, kudos and ta ta! (Added this to FeedBurner, so enjoy! :) )

  24. Hello there! This is my 1st comment here so I just wanted to give a quick shout out and say I truly enjoy reading your blog posts. Can you recommend any other blogs/websites/forums that deal with the same topics? Thanks!

  25. Berry Montee says:

    This design is incredible! You most certainly know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Excellent job. I really enjoyed what you had to say, and more than that, how you presented it. Too cool!

  26. Excellent blog post, I’ve saved this web site so hopefully I’ll see a lot more on this subject in the foreseeable future!

  27. I loved as much as you will receive carried out right here. The sketch is attractive, your authored subject matter stylish. nonetheless, you command get bought an shakiness 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.

  28. I just added this weblog to my google reader, excellent stuff. Can’t get enough! fractionation

  29. greetings!, I enjoy your current producing so a whole lot! portion people speak special regarding publish about AOL? I have an authority in such a place to end my issue. Might be that is certainly you actually! Awaiting view you.

  30. A robust reveal, I just given that on a coworker who was simply a little bit of investigation on this. And the man truth be known purchased all of us morning meal given that I found it all pertaining to her.. laugh. Thus I want to reword which will: Thnx for the treat! But yeah Thnkx for spending any time to talk about this, I sense really regarding this together with like studying further on this theme. If possible, as you develop into competence, will you views posting an individual’s webpage having added details? It’s really helpful for me. Substantial flash right up with this weblog upload!

  31. A robust write about, I just simply given this kind of on a colleague who had been doing a bit of analysis during this. And hubby in reality obtained myself morning meal because I observed them intended for her.. giggle. Therefore I want to edit which will: Thnx for the treat! But yeah Thnkx meant for plenty of time to debate this kind of, I come to feel strongly regarding it in addition to appreciate studying excess on this topic. If possible, as you change into encounter, might you thoughts adding to your site by using additional points? It’s incredibly helpful for me personally. Great browse all the way up in this blog page present!

  32. benzo fury says:

    You clearly know your stuff. Wish I could think of something clever to write here. Thanks for sharing.

  33. It’s the best time to make some plans for the future and it is time to be happy. I have read this post and if I could I wish to suggest you few interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it!

  34. I´ve really like reading this post. You use a lot of effort to writting it and that´s cool! Cheers!

  35. I like this website so much, bookmarked .

  36. Recent Blogroll Additions……

    [...]usually posts some very interesting stuff like this. If you’re new to this site[...]……

  37. Awesome website…

    [...]the time to read or visit the content or sites we have linked to below the[...]……

  38. HideHost says:

    I want to know who is hosting this website please?

  39. Diabetes says:

    I do not create many remarks, however i did a few searching and wound up here Enterprise Grade IT Services For Businesses Large & Small » Give an O(n) algorithm that sorts the array A using O(1) storage, i.e. can’t use a temporary array for storage. And I actually do have 2 questions for you if you do not mind. Could it be only me or does it look as if like a few of these responses appear like left by brain dead individuals? :-P And, if you are writing on additional social sites, I would like to follow anything new you have to post. Could you make a list of every one of your shared sites like your twitter feed, Facebook page or linkedin profile?

  40. you’ve got a fantastic weblog here! would you prefer to make some invite posts on my blog?

  41. end says:

    I think this is among the most significant info for me. And i’m glad reading your article. But should remark on some general things, The site style is ideal, the articles is really nice : D. Good job, cheers

  42. Hello man, I was just going through the net for a little info and stumple across your blog. I am seriously amazed by the information that you’ve got posted within this site. It displays how nicely you understand this theme. Book marked this site, and will be back soon. You Rock!!

  43. I appreciate a tremendous publish, can study your personal others content. thanks for your thinking for this, I really felt a lttle bit thump by this article. Thanks again again! You commit a good time. Portrays natures best by the fantastic facts here. I feel that when more individuals considered it that way, they’d possess a better time frame receive the suspend ofing the difficulty.

  44. could says:

    Definitely believe that which you said. Your favorite reason appeared to be on the internet the simplest thing to be aware of. I say to you, I definitely get annoyed while people think about worries that they just don’t know about. You managed to hit the nail upon the top and also defined out the whole thing without having side effect , people could take a signal. Will probably be back to get more. Thanks

  45. Thanks for the info…this blog has never let me down..and by the way, i love your theme. Catch your next post.

  46. can not even imagine.

  47. Hiya! I simply wish to give a huge thumbs up for the nice info you’ve gotten here on this post. I shall be coming back to your weblog for extra soon.

  48. There isn’t any back garden without its

  49. Thank you, I have been searching for information about this subject for ages and yours is the best I have located so far. how to pick up women

Leave a Reply