If I have a python list, I assume accessing element [0] is constant time. Is accessing element [-1] - i.e., the last element - O(1)? O(number of list elements)? Something else?
I have a list datapoints = [ [ time, data ], [ time, data ], ..., [ time, data ] ]. I am trying to figure out "what is my most recent data point". Obviously it's most convenient to just do datapoints[-1][0], but if that's slow I'm happy to maintain a separate variable that tracks the most recent time.