Live data from Hacker News

Show HN: Sorted list data struct with insert/get(index) in lg time

github.com

1–4 of 4 posts

Re: Show HN: Sorted list data struct with insert/get(index) in lg time

#4
post #2

What is the advantage compared to TreeSet from standard library?

SortedList lets you get(i) to get the ith item in sorted order, and that's as fast as a TreeSet contains. It also splays so near each other faster the second+ time called. I use this for UIs that do scrolling/paging, and for models/view s that need to query ordered data. For example I have messages coming in real time, put them in a sorted list by importance, and display with a simple list view. Each time a new message comes in, it's lg time to update the view regardless of how long it is.