list vs vector

Правка en2, от tirupati, 2015-07-27 20:37:56

I usually use vector arr[n] to represent the adjacency list of a n-vertex graph. What if I use list instead of a vector. I mean it's O(1) to add an edge in the list similar to vector(amortized) also it's O(n) to check if there is an edge between two vertices in both vector and list. I have seen most people using vector instead of list. Are there any performance costs associated with lists compared to vector?

THANK YOU :)

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский tirupati 2015-07-27 20:37:56 4 Tiny change: 'nTHANK YOU?' -> 'nTHANK YOU :)'
en1 Английский tirupati 2015-07-27 20:36:40 444 Initial revision (published)