...

/

The Need for Efficiency

The Need for Efficiency

Understand the need for efficiency to implement complex problems.

The operations supported by the most commonly used data structures are not hard to implement correctly. We can store the data in an array or a linked list. Each operation can be implemented by iterating over all the elements of the array or list and possibly adding or removing an element.

This kind of implementation is easy but not very efficient. Does this really matter? Computers are becoming faster and faster. Maybe the obvious implementation is good enough. Let’s do some rough calculations to find out.

Imagine an application with a moderately-sized data set, say of one million (106),(10^6), items. In most applications, it is reasonable to assume that the application will want to look up each item at least once. This means we can expect to do at least one million (10610^6) searches in this data. If each of these 10610^6 ...

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy