Skip to content

There are only 3 data structures

deriveit.org
6 pointsandrewp1233 comments
On HN

Comments

" I can't imagine anything else you can possibly store about relative elements besides index and order (and nothing). Graphs are their own other planet, and I don't think we can easily say much about them. So the 3 data structure types you can have are:

1. indexed data structures with an O(n) worst-case operation

2. order-less data structures with an O(1) worst-case operation

3. sorted data structures with an O(log n) worst-case operation

That's it. Let me know what you think"

I disagree.

sorting is a O(n*log(n)) worst-case operation for example.

The article explicitly states that sorting is O(n log n), giving rise to log n per element. I think you missed that I'm talking about adding/removing/reading a single element at a time.

I'm not sure if this is very obvious or very interesting. Let me know what you think (I wrote the article).

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.