Lesson 1.3: Algorithms Flashcards

1
Q

Is defined as the finite sequence of instructions, each of which has a clear meaning and can be performed with a finite amount of effort in a finite length of time.

A

Algorithm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

IT is a set of steps, to accomplish a task.

A

Algorithm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Optimization of a program is directly concerned with __________?

A

Algorithm Design

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Incremental approach to the construction of program structure. Modules are integrated by moving downward through the control hierarchy. Starting module is the main program.

A

Top-down design

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Works in opposite direction. Starting with specific modules and build them into more complex structures, ending at the top.

A

Bottom-up design

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

This algorithm complexity deals with the amount of time it needs to run to completion

A

Time Complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

This algorithm complexity deals with the amount of space it needs to run to completion

A

Space Complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Choosing an approach depending on the constraints.

A

Time-Space Trade-Off

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Is a characterization scheme that allows us to measure the properties of algorithms.

A

Big Oh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The 7 algorithms. (CLLQPEF)

A
  1. Constant time algorithm
  2. Logarithmic time algorithm
  3. Linear time algorithm
  4. Quasilinear time algorithm
  5. Polynomial time algorithm
  6. Exponential time algorithm
  7. Factorial time algorithm
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Algorithms under this class take a constant amount of time no matter how big is the problem. For example, taking the average of three numbers.

A

Constant time algorithm O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

These algorithms typically divide the number of items it must consider by a fixed fraction every step. Usually, the base of the algorithm is 2 because inputs are being divided into two groups repeatedly.

A

Logarithmic time algorithm O(lg n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

These algorithms go through all of the elements or inputs that they need to process. An example is finding the maximum (or minimum) of an array).

A

Linear time algorithm O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

These algorithms loop over all the items and for each loop performs O(lg n) calculations on that item. Examples are some efficient sorting algorithms we will cover in Module 4 like quicksort, mergesort, etc.

A

Quasilinear time algorithm O(n lg n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

These algorithms loop over the input, and for every input, loop over the inputs again (for the case of O(n2)). This is considered a polynomial runtime if runtime involves any polynomial involving n. A good example is of a polynomial algorithm O(n2) is bubble sort.

A

Polynomial time algorithm O(n^2), O(n^3), …, O(n^100), etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

These algorithms grow extremely quickly so these are practical only for small problems. An example is the knapsack problem.

A

Exponential time algorithm O(2^n)

17
Q

These are relatively inefficient algorithms that look for the optimal arrangement of the inputs. An example is the traveling salesman problem.

A

Factorial time algorithm O(n!)

18
Q

It indicates processing steps that are essential in the specification of any algorithm. Basically, the lines of codes are executed one after the other as they appear.

A

Sequence

19
Q

This provides the facility for selected processing based on some logical fact. For example, IF condition in Java.

A

Conditional

20
Q

When a set of instructions are executed a number of times.

A

Repetition

21
Q

In Java, _____ is still a reserved word but it does not have any function.

A

goto

22
Q

Such programming which gives exact readability and procedural flow to the reader is called __________.

A

Structured Programming