May-18-2023, 07:18 PM
May-18-2023, 08:00 PM
Python Sorted Containers
>>> from sortedcontainers import SortedSet >>> >>> lst = ['car', 'taxi', 'car', 'bus', 'taxi', 'car', 'train'] >>> ss = SortedSet(lst) >>> for item in ss: ... print(item) ... bus car taxi train
May-20-2023, 10:59 PM
i should have also said i want the fetch-one-next-item timing to be the same as or close that for plain set(). sorting the entire set and returning the first from that result is timing i want to avoid. i implemented this kind of thing in C many years ago and it has served me well for almost every container/dictionary usage over the years of coding in C. it worked like a set but allowed each item to be assigned a value. i could search for a given key from the front or the back. multiple items with the same key were allowed (and could be assigned different values). once found, the "next key" could be requested. the group of like keys were kept in the order inserted, and a "next by next" scan would step through them in that order. a "previous by previous" scan would get them in reverse order. it was implemented as an AVL binary tree and outperformed a hash up to a size around 1,200,000.
Jun-09-2023, 08:09 AM
I think it's trilingual. Because a person who speaks two languages is often called bilingual. The way people usually talk for fun is byelingual because they lose a little bit of each language.
<url snipped>
<url snipped>