Organizing Sequential Data (TimeStamps) Overthinking?

Larry Bates larry.bates at websafe.com
Fri Oct 19 15:03:15 EDT 2007


xkenneth wrote:
> All,
> 
>    Just a quick question. I want to be able to have a data structure
> that organizes data (timestamps I'm working with) sequentially, so
> that i can easily retrieve the first x amount of timeStamps without
> iterating over a list. My thought was to use a binary tree, am i
> overthinking the problem to try and implement this structure inside of
> python? I was also hoping this would already be done for me.
> 
> Regards,
> Ken
> 
Sounds a little like premature optimization here.  It depends on how many 
timestamps you are talking about.  Certainly if you have a lot (millions),
you should implement binary search, but I would write code first and if it is 
too slow, fix that part.

-Larry



More information about the Python-list mailing list