List
1 | # list |
String
1 | # String |
A big difference between list
and string
is that lists can be modified while strings cannot. This is referred to as mutability. Lists are mutable, strings are immutable.
Set
A set
is an unordered collection of zero or more immutable python data object. Lookup/Insert/Delete O(1) time in averate.
1 | mySet = {2, 3, 5, 'cat'} |
Dictionary
Dictionaries are collections of associated pairs of items where each pair consists of a key and a value.
1 | myDict = {'david': 1410, 'brad': 12} |
Priority Queue
Can be implemented with heapq
libary.
1 | from heapq import * |