Java's TreeSet equivalent in Python?
Posted
by viksit
on Stack Overflow
See other posts from Stack Overflow
or by viksit
Published on 2010-04-26T01:26:51Z
Indexed on
2010/04/26
1:33 UTC
Read the original article
Hit count: 276
I recently came across some Java code that simply put some strings into a Java TreeSet, implemented a distance based comparator for it, and then made its merry way into the sunset to compute a given score to solve the given problem.
My questions,
Is there an equivalent data structure available for Python?
- The Java treeset looks basically to be an ordered dictionary that can use a comparator of some sort to achieve this ordering.
I see there's a PEP for Py3K for an OrderedDict, but I'm using 2.6.x. There are a bunch of ordered dict implementations out there - anyone in particular that can be recommended?
Thanks.
© Stack Overflow or respective owner