in reply to Re: add missing elements and remove duplicates....and some more questions.
in thread add missing elements and remove duplicates....and some more questions.

Hi,

Thanks for the encouraging comments. However. I was not thinking in those very high level complex terms. I just tried to keep it simple. I have not studied algorithms. May be in future I will be able to write this using a cool complex algorithm. Here's how I thought about it.

Before writing this script I thought its better to keep it simple so that if I get a large array, then checking an element, say x with the next and previous could be computationally intensive. I will Google about the log n stuff and try to understand it.

Thinkpad T430 with Ubuntu 16.04.2 running perl 5.24.1 thanks to plenv!!
  • Comment on Re^2: add missing elements and remove duplicates....and some more questions.
  • Download Code

Replies are listed 'Best First'.
Re^3: add missing elements and remove duplicates....and some more questions.
by Anonymous Monk on Apr 23, 2017 at 12:54 UTC

    This is the "big O notation". You can read about it on wikipedia: analysis of algorithms. But don't get sidetracked too much with the "dry stuff". Maybe ask for the next problem, or another variant, because you appear to have conquered this one already.