Comprehensive

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

computational problem

Input/output relationship that an algorithm achieves using a specific computational procedure.

sorting problem

Input: A sequence of n numbers <a1, a2, ... , an> Output: A permutation (reordering) <a'1, a'2, ... a'n> of the input sequence such that a'1 <= a'2 <= ... <= a'n.

merge sort

1. Divides n-element sequence into two subsequences of n/2 elements each. 2. Sorts the subsequences recursively. 3. Merges the two sorted subsequences to produce the sorted answer

loop invariant

A formal way or writing properties of a loop. Ex. For insertion sort, we would say "At the start of each iteration of the for loop, the subarray consists of the elements originally in the subarray but in sorted order.

algorithm

A sequence of computational steps that transform the input into the output.

sentinel value

A special value that indicates the end of a set of data or of a process.

data structure

A way to store and organize data in order to facilitate access and modifications.

randomized algorithm

Algorithm that makes random choices to allow a probabilistic analysis and yield an expected running time.

"multithreaded" algorithms

Algorithms that take advantage of multiple cores.

recursive

An algorithm that calls itself one or more times to deal with closely related subproblems in order to solve a given problem.

correct algorithm

An algorithm that, for every input instance, halts with the correct output.

probabilistic analysis

Analysis that produces "average" input so that an average case running time can be determined for a given algorithm.

algorithm

Any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output.

Which of the following is NOT a characteristic that is common to many algorithmic problems? A. Has many candidate solutions B. Has no efficient solutions C. Has practical applications

B

Which of the following is NOT a common measure of input size? A. Number of items in the input B. The ASCII code C. Number of graph edges D. Number of graph vertices E. Total number of bits

B

divide and conquer approach

Breaking the problem into several subproblems that are similar to the original problem but smaller in size, solve the subproblems recursively, and then combine these solutions to create a solution to the original problem.

Due to _____ and _____ an algorithm whose running time has higher order of growth might take less time for small inputs than an algorithm whose running time has a lower order of growth. A. programming language, implementation B. the amount of white space, value of n C. constant factors, lower order terms

C

Which of the following is NOT a characteristic of the RAM model of computation? A. Instructions are executed one after another, with no concurrent operations. B. Has two data types: integer and floating point. C. Each instruction takes a variable amount of time

C

Which of the following is NOT a step of the divide and conquer paradigm? A. Divide B. Combine C. Sort D. Conquer

C

instance of a problem

Consists of the input (satisfying whatever constraints are imposed in the problem statement) needed to compute a solution to the problem.

Which of the following is a control instruction commonly found in real computers? A. Conditional branch B. Unconditional branch C. Subroutine Call D. Subroutine Return E. All of these F. None of these

E

Which of the following relies on algorithms? A. Hardware design B. GUI C. Routing in networks D. Compilers, interpreters, assemblers E. All of these F. None of these

E

Which of the following is NOT a commonly found arithmetic instruction in real computers? A. Multiply B. Divide C. Remainder D. Floor E. Ceiling F. Square root

F

Which of the following is a data movement instruction commonly found in real computers? A. Paste B. Cut C. Load D. Store E. Copy F. A,B, and E G. C,D, and E

G

Initialization

It is true prior to the first iteration of the loop.

Generally, does insertion sort or merge sort have a smaller constant factor?

insertion sort

Which of the following is a factor that affects which algorithm is best for an application? A. Number of items to be sorted B. Extent to which the items are already somewhat sorted C. Computer architecture D. Kind of storage devices used E. None of these F. All of these

F

Maintenance

If it is true before an iteration of the loop, it remains true before the next iteration.

multicore computer

Type of "parallel computer".

A correct algorithm _____ the given computational problem.

solves

_____ is a fundamental operation in computer science because many programs use it as an intermediate step.

sorting

worst-case running time

the longest running time for any input of size n

True or False: A small change to the problem statement can cause a big change to the efficiency of the best known algorithm.

true

True or False: Chips can melt if their clock speeds become high enough.

true

True or False: If an efficient algorithm exists for any one NP-complete problem, then efficient algorithms exist for all of them.

true

True or False: Insertion sort is an efficient algorithm for sorting a small number of elements.

true

True or False: Proving that the Initialization and Maintenance properties hold is similar to the base case step of mathematical induction.

true

True or False: The "average case" is often roughly as bad as the worst case.

true

True or False: The worst-case running time of an algorithm gives us an upper bound on the running time for any input.

true

True or False: Total system performance depends on choosing efficient algorithms as much as choosing fast hardware.

true

True or False: We usually consider a lower order of growth to be more efficient.

true

True or False: When the Initialization and Maintenance properties hold, the loop invariant is true prior to every iteration of the loop.

true

linear function of n

an + b where a and b are constants that depend on the statement costs

rate or order of growth

highest power of n present in a formula

pseudocode

Not "real" code that is used to convey the essence of an algorithm clearly and concisely.

Running time for merge sort

O(n lg n)

Running time for insertion sort

O(n^2)

short circuiting boolean operators

Operators that can terminate a statement even if the whole statement has not been evaluated.

Analyzing an algorithm

Predicting the resources that the algorithm requires.

NP-complete problems

Problems that have no known efficient solution.

keys

The items that we wish to sort.

running time

The number of primitive operations or "steps" executed on a particular input.

recurrence equation

The overall running time on a problem of size n in terms of the running time on smaller inputs.

Termination

When the loop terminates, the invariant gives a useful property that helps show that the algorithm is correct.

quadratic function of n

an^2 + bn + c where a, b, and c are constants that depend on the statement costs

Incorrect algorithms can be useful if we can control their _____.

error rate

True or False: A single data structure works well for all purposes.

false

True or False: All applications explicitly require algorithmic content at the application level.

false

True or False: It has been proven that an efficient algorithm for NP-complete problems cannot exist.

false

A(n) _____ algorithm may not halt at all on some input instances, or it might halt with an incorrect answer.

incorrect


संबंधित स्टडी सेट्स

Create Your Successful Agile Project

View Set

AZ-303 - Module 5 - Implement Load Balancing and Network Security

View Set

World History chapter 22 & 23 - Abeka

View Set

Abdominopelvic Regions / Quadrants

View Set

Pearson Chapter 15: Development of the Nervous System

View Set