Ciena

www.ciena.com
Employer Engaged

Interview Question

Software Engineer Internship Interview San Jose, CA

Difference btw Linked list and array Run time efficiencies

  for both . Accessing via linked list and Array. How to find weather a linked list has a loop?
Answer

Interview Answer

1 Answer

0

So if you know the memory addresses that you are working with you can actually add the magnitude of the memory addresses that are being linked, so the 0xblahblah for each node and if the linked list is loop free it should be the sum of all the range of memory addresses used. If the sum is less than that, it loops, therefore it recreates a different total at the end.

Giray on Nov 19, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.