list vs vector

Revision en2, by 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 :)

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English tirupati 2015-07-27 20:37:56 4 Tiny change: 'nTHANK YOU?' -> 'nTHANK YOU :)'
en1 English tirupati 2015-07-27 20:36:40 444 Initial revision (published)