A primary concern for this course is efficiency. You might believe that faster computers make it unnecessary to be concerned with efficiency. However… So we need special training.
If you are willing to pay enough in time delay. Example: Simple unordered array of records.
Alternate definition: Better than known alternatives (“relatively efficient”). Space and time are typical constraints for programs. This does not mean always strive for the most efficient program. If the program operates well within resource constraints, there is no benefit to making it faster or smaller.
Typically want the “simplest” data structure that will meet the requirements.
These questions often help to narrow the possibilities. If data can be deleted, a more complex representation is typically required.
The space required includes data and overhead. Some data structures/algorithms are more complicated than others.
The first goal is a worldview to adopt The second goal is the “nuts and bolts” of the course. The third goal prepares a student for the future.
The concept of an ADT is one instance of an important principle that must be understood By any successful computer specialist: managing complexity through abstraction.
In this class, we frequently move above and below “the line” separating logical and physical forms.
But NO constraints on HOW the problem is solved
“ Correct” means computes the proper function. “ Concrete steps” are executable by the machine in question. We frequently interchange use of “algorithm” and “program” though they are actually different concepts.
Transcript
1.
Data Structures and Algorithm Analysis Dr. Nagwa Badr
One data structure that meets these requirements is the hash table (chapter 9).
Records are accessible by account number (called an exact-match query )
Hash tables allow for extremely fast exact-match search.
Hash tables also support efficient insertion of new records.
Deletions can also be supported efficiently (but too many deletions lead to some degradation in performance – requiring the hash table to be reorganized).
Algorithm : a method or a process followed to solve a problem.
A recipe: The algorithm gives us a “recipe” for solving the problem by performing a series of steps, where each step is completely understood and doable.
An algorithm takes the input to a problem (function) and transforms it to the output.
A computer program is a concrete representation of an algorithm in some programming language.
Naturally, there are many programs that are instances of the same algorithms, since any modern programming language can be used to implement any algorithm.
Think of a program you have used that is unacceptably slow. Identify other basic operations that the program performs quickly enough.
Imagine that you are a shipping clerk for a large company. You have just been handed about 1000 invoices, each of which is a single sheet of paper with a large number in the upper right corner. The invoices must be sorted by this number, in order from lowest to highest. Write down as many different approaches to sorting the invoices as you can think of.
Be the first to comment