Intel Corporation

  www.intel.com
  www.intel.com

Interview Question

Software Engineer Interview Santa Clara, CA

When would you want to use a linked list over an array

  ? When wouldn't you want to use a linked list?
Answer

Interview Answer

1 Answer

2

linked list pros:
   - insertion time is O(1)
   - good to use when list size varies significantly
   - better heap usage

linked list cons:
   - search linked list is O(n)
   - heap fragmentation in the long term
   - possible list corruption (introduction of cycles)
   - has several corner cases to deal with

Anonymous on Apr 13, 2011

Add Answers or Comments

To comment on this Question, Sign In with Facebook or Sign Up