Lecture 1

What are the two things that make up programs?
The two things that make up programs are:

  1. Algorithms.
  2. Data structures.

What is a data structure?
A data structure is a particular way of storing and organizing data in a computer so it can be accessed efficiently.

What are the two classifications of data structures?
The two classifications of data structures are:

  1. Linear.
  2. Nonlinear.

How are elements in a linear data structure accessed?
Elements in a linear data structure are accessed sequentially.

What are some examples of linear data structures?
Some examples of linear data structures include:

  • Arrays.
  • Linked Lists.
  • Stacks.
  • Queues.

How are elements in a nonlinear data structure accessed?
Elements in a nonlinear data structure are accessed in a nonlinear order.

What are some examples of nonlinear data structures?
Some examples of nonlinear data structures include:

  • Trees.
  • Graphs.

What is a data type in a programming language?
A data type in a programming language is a set of data with predefined values.

What are some examples of data types?
Some examples of data types include:

  • Integer.
  • Float.
  • Double.
  • Character.
  • String.

What are the two types of data types at the top level?
At the top level, the two types of data types are:

  1. System-defined / primitive data types.
  2. User-defined data types.

All primitive data types support ... operations.
All primitive data types support basic operations.

What provides the implementations for the primitive data types?
The system provides the implementations for the primitive data types.

User-defined data types are defined along with ...
User-defined data types are defined along with their operations.

What does ADT stand for?
ADT stands for Abstract Data Type.

How are ADTs defined?
ADTs are defined only by the operations they support and the mathematical constraints on the results of those operations.

An Abstract Data Type (ADT) is a data type where only the ... is defined but not the ...
An Abstract Data Type (ADT) is a data type where only the behavior is defined but not the implementation.

A Concrete Data Type contains an ... of an ...
A Concrete Data Type contains an implementation of an ADT.

What are Concrete Data Types also referred to as?
Concrete Data Types are also referred to as a data structure.

What are the two parts of an Abstract Data Type (ADT)?
The two parts of an ADT are:

  1. The declaration of data.
  2. The declaration of operations.

When is an operation said to be efficient?
An operation is said to be efficient if it solves the problem within its resource constraints.

What are the two resource constraints of an operation?
The two resource constraints of an operation are:

  1. Time.
  2. Space.

What is the cost of an operation?
The cost of an operation is the amount of resources that its execution consumes.

What are the three steps of selecting a data structure?
The three steps of selecting a data structure are:

  1. Analyze the problem to determine the resource constraints a solution must meet.
  2. Determine the basic operations that must be supported and the resource constraints for each one.
  3. Select the data structure that best meets the requirements.

What are three questions to ask when selecting a data structure?
The three questions to ask when selecting a data structure are:

  1. Is all of the data inserted into the data structure at the beginning, or are insertions interspersed with other operations?
  2. Can data be deleted?
  3. Is all of the data processed in some well-defined order, or is random access allowed?

What are the three requirements for a data structure?
The three requirements for a data structure are:

  1. There must be space for it to store each item.
  2. There must be time to perform each basic operation.
  3. You must put in programming effort.

What is an algorithm?
An algorithm is a step-by-step unambiguous sequence of instructions to solve a well-defined problem.

What are the two criteria for evaluating an algorithm?
The two criteria for evaluating an algorithm are:

  1. Correctness - Does the algorithm give a solution to the problem in a finite number of steps?
  2. Efficiency - How much resources does it take to execute?

Algorithm analysis helps us to determine which algorithm is most ... in terms of resource usage such as ..., ..., and ...
Algorithm analysis helps use efficient in terms of resource usage such as time, space, and energy.

What does the analysis of algorithms mainly compare among other factors?
The analysis of algorithms mainly compares running time among other factors.

What is Run Time Analysis?
Run Time Analysis is the process of determining how processing time increases as the size of the input increases.

What is the input size?
The input size is the number of elements in the input.

What is the problem with comparing algorithms using execution times?
The problem with comparing algorithms using execution times is that executions times are specific to a computer.

What is the problem with comparing algorithms using the number of statements executed?
The problem with comparing algorithms using the number of statements executed is that it varies with the programming language and the style of the individual programmer.

What is the ideal solution for comparing algorithms?
The ideal solution for comparing algorithms is expressing the running time of each algorithm as a function of the input size , as in , and then comparing those.

Quote from John Gardner, "Excellence"

The society that scorns excellence in plumbing because plumbing is a humble activity and tolerates shoddiness in philosophy because it is an exalted activity will have neither good plumbing nor good philosophy. Neither its pipes nor its theories will hold water.