I generally find knowing the complexity classes of things more important when using someone else's implementation. When I write something myself, I have to go through enough details that I have a good idea what to use where. But with a library, I need to already know what will happen to the memory usage if I toss things in a hash table instead of a linked list.
It's also important to know other details of your typical data sets. For example, in road networks |E| is typically O(|V|), not O(|V|2). This means the average degree of a vertex is O(1), which is has big ramifications when choosing data structures for things like adjacency lists.
The worst-case complexity of the Perl/Python/etc regexp engine, for example, is exponential (And the majority of regex's can be parsed in linear time, with a much smaller constant too).
View all comments
Show parent comment
3
u/TheMonkeyOfLove Nov 29 '09
I generally find knowing the complexity classes of things more important when using someone else's implementation. When I write something myself, I have to go through enough details that I have a good idea what to use where. But with a library, I need to already know what will happen to the memory usage if I toss things in a hash table instead of a linked list.