Facebook

www.facebook.com

Interview Question

Software Engineer Interview

Smallest missing natural number in a linked list in linear

  time without a hash table.
Answer

Interview Answer

1 Answer

1

(sum of 1st n numbers) - (sum of values in linked list)
= n(n+1)/2 - (node1->data +...+noden->data)

Anonymous on Oct 4, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.