gudii9
asked on
ArrayList and LinkedList
I would lie to now about ArrayList and LinkedList. when, how, where, why to use them, advantages, disadvantages of the implementations.
I read ArrayList insertion, deletion slow compared to LinkedList. Why is it so.
Also how to decide which one to use.
I was not clear on this concept. thanks in advance
I read ArrayList insertion, deletion slow compared to LinkedList. Why is it so.
Also how to decide which one to use.
I was not clear on this concept. thanks in advance
arraylist - internally array of objects - have to reserve array for all objects, get complexity O(1),
linkedlist - two directional pointer list (like in c language), does not reserve the whole array, however getting indexed object e.g. linkedlist.get(10) - starts from head and iterates elements to get 10th, getting complexity is O(n)
linkedlist - two directional pointer list (like in c language), does not reserve the whole array, however getting indexed object e.g. linkedlist.get(10) - starts from head and iterates elements to get 10th, getting complexity is O(n)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
what is O(1) and O(n). please elaborate on this
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
read here:
http://stackoverflow.com/questions/322715/when-to-use-linkedlist-over-arraylist