Re: [Tutor] how to keep track of sorted lists

2012-11-06 Thread Albert-Jan Roskam
> On 11/03/2012 10:40 AM, Albert-Jan Roskam wrote: >>> On 11/03/2012 09:04 AM, Albert-Jan Roskam wrote: >>   Hello, >>> >>> (I haven't run the code, as it was not presented in a form that I > could >>> do a single copy/paste.  So I may have missed some subtlety in the > code.) >> >>

Re: [Tutor] how to keep track of sorted lists

2012-11-03 Thread Steven D'Aprano
On 04/11/12 01:40, Albert-Jan Roskam wrote: Hi, sorry about that. Here's a copy/pastable version. I also added a 'data' parameter as my original code was too synthetic in this respect. The more realistically, the data come from some getter method. I don't understand what you mean by that. i

Re: [Tutor] how to keep track of sorted lists

2012-11-03 Thread Steven D'Aprano
On 04/11/12 00:04, Albert-Jan Roskam wrote: Hello, I want to make a get() method that uses a binary search. This requires the data to be sorted which is an expensive operation, so I would like to do this no more often than needed. Reset your intuition. Sorting an almost-sorted list with Timso

Re: [Tutor] how to keep track of sorted lists

2012-11-03 Thread Dave Angel
On 11/03/2012 10:40 AM, Albert-Jan Roskam wrote: >> On 11/03/2012 09:04 AM, Albert-Jan Roskam wrote: > >>> Hello, >> >> (I haven't run the code, as it was not presented in a form that I could >> do a single copy/paste. So I may have missed some subtlety in the code.) > > Hi, sorry about that. H

Re: [Tutor] how to keep track of sorted lists

2012-11-03 Thread Albert-Jan Roskam
> On 11/03/2012 09:04 AM, Albert-Jan Roskam wrote: >> Hello, > > (I haven't run the code, as it was not presented in a form that I could > do a single copy/paste.  So I may have missed some subtlety in the code.) Hi, sorry about that. Here's a copy/pastable version. I also added a 'data' param

Re: [Tutor] how to keep track of sorted lists

2012-11-03 Thread Dave Angel
On 11/03/2012 09:04 AM, Albert-Jan Roskam wrote: > Hello, (I haven't run the code, as it was not presented in a form that I could do a single copy/paste. So I may have missed some subtlety in the code.) > I want to make a get() method that uses a binary search. This requires the > data to be so

[Tutor] how to keep track of sorted lists

2012-11-03 Thread Albert-Jan Roskam
Hello, I want to make a get() method that uses a binary search. This requires the data to be sorted which is an expensive operation, so I would like to do this no more often than needed. Which of the to classes below is the best way to keep track of the sorted lists? TestOne stores them in sepa