Well,

    Even if its O(n) , one way to reduce the steps required for finding the length of the list(which is required here) is two use the Hare and Tortoise method where there are two pointers (Hare and the Tortoise) . The Hare moves two steps for each step the tortoise takes. The tortoise would then be in the centre when the Hare has traversed the entire list. We could the use the Tortoise to move to the req. (n-i)th pos..
On 12/3/05, Abhi <[EMAIL PROTECTED]> wrote:

In a link list the search is always going to be O(n) unless you
customize/modify it.

-Abhishikt




--
Well," said Owl, "the customary procedure in such cases is as follows."
"What does Crustimoney Proseedcake mean?" said Pooh. "For I am a Bear of Very Little Brain, and long words Bother me."
"It means the Thing to Do."
"As long as it means that, I don't mind," said Pooh humbly.

Reply via email to