Chapter 10

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

Name and describe the two parts of a recursive definition of a function.

1. an anchor or base case that specifies the value of the function of one or more values of the parameter(s). 2. an inductive step that defines the function's value for the current value of the parameter(s) in terms of previously defined function values and/or parameter values

A program that uses the STL algorithms must contain the directive #include ______.

<algorithm>

The library _____ contains algorithms designed for processing sequences of numbers.

<numeric>

If T(n)>5000n^3 for all n<100000, then T(n) cannot be O(n^3). (True or False)

False

If the computing time of an algorithm is O(2^n), it should perform acceptably for most large inputs. (True or False)

False

Most of the STL algorithms operate on specific containers. (True or False).

False

The worst case computing time of binary search is O( _____ ).

O(log base 2 of n)

The worst case computing time of linear search is O( ____ )

O(n)

_______ is the phenomenon of a function calling itself.

Recursion

In the early days of computing, which was more important?

Space

Define what it means to write T(n) is O(f(n))

There is some constant C such that T(n)≤C*f(n) for all sufficiently large values of n

In most current applications, which is most important?

Time

What two criteria are usually used to measure an algorithm's efficiency?

Time and Space

A non-recursive function for computing some value may execute more rapidly than a recursive function that computes the same value. (True or False)

True

If T(n)≤5000n^3 for all n≥100000, then T(n) is O(n^3). (True or False)

True

If T(n)≤5000n^3 for all n≥100000, then T(n) is O(n^4). (True or False)

True

The Standard Template Library contains more than 80 function templates known as generic ________.

algorithms

Find f(0): int f(int n){ if(n==0) return 0; else return n+f(n-1); }

f(0)=0

Find f(5): int f(int n){ if(n==0) return 0; else return n*f(n-1); }

f(5)=0

For the following recursive function, find f(5): int f(int n){ if(n==0) return 0; else return n+f(n-1); }

f(5)=15

Most of the STL algorithms designate sequences by two iterators. Where in the sequence are these iterators positions.

first element and just past the last element

What happens when you try to find f(-1): int f(int n){ if(n==0) return 0; else return n+f(n-1); }

infinite recursion

For a recursive algorithm, a(n) _____ relation expressed the computing time for inputs of size n in terms of smaller-sized inputs.

recurrence


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

Microscopic Examination of Urine Sediment

View Set

BSCC 1011 Biology 2 Test 2 Review

View Set

American Homicide Discussion Question 2-7

View Set

Nervous System: Autonomic and Motor Systems

View Set

Chapter 16: Speaking to Persuade

View Set

Aging Biology - Quizzes Module 1-6

View Set

Microbiology, Ch 20, Nester's 9th

View Set