Jump to content
xisto Community

vivek.m

Members
  • Content Count

    2
  • Joined

  • Last visited

  1. That's same as what I said... In first scan, find the length and in second scan, find the required element. This seems to be only tortoise-tortoise scan. The other answer (your and sanjay's answer) is more efficient with worst case operations half of what is required in first answer. complexity will be o(n) in both cases. (my bad. i had to edit. i mentioned complexity o(n^2) incorrectly.) Thanks for the problem.
  2. the most basic and the only answer that came to my mind (actually, my frnd's mind. I am too laazy to use mine) is to find length and then to find the (l-n)th element with o(n2) complexity. i am interested in your answer.. it's more than a month since you posted your question.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.