Contents    Page-10    Prev    Next    Page+10    Index   

Using Library Packages

Lead us not into temptation,
but deliver us from evil.

This seems like good advice for designers of library packages, but it is not necessarily followed.

Temptation: Oh, look, there's a method that does what I want.

Evil: If you use that method, your program is O(n2).

The Moral: You need to understand the Big-O of library methods in order to use them appropriately. The Big-O of different methods varies between packages that do essentially the same thing, such as ArrayList and LinkedList, so that the packages are not interchangeable. There may also be restrictions on how library packages can be used.