Tips and Traps¶
listis essentially a resizable array of objects in Python.Almosts all methods of list are in-place.
list.popis inplace and returns the removed element.To get unique elements in a list, you can first coerce the list to a set and then convert the set back to a list.
unique_list = list(set(alist))
Collections and Iterators in C++
Collections
-
Prefer
std::dequetostd::vectorwhen the size of the collection is unknow. -
Suppose set
AandBare two set with the same type and setCis another set with the same value type but a different comparison function, then it is still valid to insert …