Skip to main content
Updated answer; formatted for language and code
Source Link
Azeem
  • 15k
  • 4
  • 36
  • 53

Here is the big OBig-O notation in both ArrayListArrayList and LinkedListLinkedList and also CopyOnWrite-ArrayList
CopyOnWrite-ArrayList:

ArrayList
get --> O(1)
add --> O(1)
contains --> O(n)
next --> O(1)
remove --> O(n)
iterator.remove --> O(n)


**LinkedList**
get --> O(n)
add --> O(1)
contains --> O(n)
next --> O(1)
remove --> O(1)
iterator.remove --> O(1)

**CopyOnWrite-ArrayList**
get --> O(1)
add --> O(n)
contains --> O(n)
get                 O(1)
add                 O(1)
contains            O(n)
next                O(1)
remove              O(n)
iterator.remove     O(n)
next --> O(1)

LinkedList

remove --> O(n)
get                 O(n)
add                 O(1)
contains            O(n)
next                O(1)
remove              O(1)
iterator.remove     O(1)
iterator.remove --> O(n)

CopyOnWrite-ArrayList


 
get                 O(1)
add                 O(n)
contains            O(n)
next                O(1)
remove              O(n)
iterator.remove     O(n)
Based on these you have to decide what to choose :)

Based on these you have to decide what to choose. :)

Here is the big O notation in both ArrayList and LinkedList and also CopyOnWrite-ArrayList
ArrayList
get --> O(1)
add --> O(1)
contains --> O(n)
next --> O(1)
remove --> O(n)
iterator.remove --> O(n)


**LinkedList**
get --> O(n)
add --> O(1)
contains --> O(n)
next --> O(1)
remove --> O(1)
iterator.remove --> O(1)

**CopyOnWrite-ArrayList**
get --> O(1)
add --> O(n)
contains --> O(n)
next --> O(1)
remove --> O(n)
iterator.remove --> O(n)

  Based on these you have to decide what to choose :)

Here is the Big-O notation in both ArrayList and LinkedList and also CopyOnWrite-ArrayList:

ArrayList

get                 O(1)
add                 O(1)
contains            O(n)
next                O(1)
remove              O(n)
iterator.remove     O(n)

LinkedList

get                 O(n)
add                 O(1)
contains            O(n)
next                O(1)
remove              O(1)
iterator.remove     O(1)

CopyOnWrite-ArrayList

get                 O(1)
add                 O(n)
contains            O(n)
next                O(1)
remove              O(n)
iterator.remove     O(n)

Based on these you have to decide what to choose. :)

Source Link

Here is the big O notation in both ArrayList and LinkedList and also CopyOnWrite-ArrayList
ArrayList
get --> O(1)
add --> O(1)
contains --> O(n)
next --> O(1)
remove --> O(n)
iterator.remove --> O(n)


**LinkedList**
get --> O(n)
add --> O(1)
contains --> O(n)
next --> O(1)
remove --> O(1)
iterator.remove --> O(1)

**CopyOnWrite-ArrayList**
get --> O(1)
add --> O(n)
contains --> O(n)
next --> O(1)
remove --> O(n)
iterator.remove --> O(n)

Based on these you have to decide what to choose :)