>>> The Lee-Man <[email protected]> schrieb am 24.11.2014 um 18:04 in Nachricht <[email protected]>: [...] > Here's the problem: the submitted patch makes this > particular use case O(1). You can't get much faster
Are you sure? You modified the compare function used by sort. Even if the list is sorted before you add a new entry at the end, more tan one call to the compare function is performed (unless I miss the obvious). Typically the best you can get is like O(log2(n)) (for binary search) > than that, i.e. it takes a fixed time no matter how > many sessions are present. > > The only patches I can come up with make that > search take O(n). That's because the only If you search for the extreme value of an unsorted list with n elements, you can't beat that. That's why you (build and) sort the list if it's intended to be searched more than once, I guess. > way other than caching to find the "last session > used" is to search through the session list. > [...] -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/open-iscsi. For more options, visit https://groups.google.com/d/optout.
