Exam 3: The Efficiency of Algorithms

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Sequential search is an order-n algorithm in the average case.

Free
(True/False)
4.8/5
(34)
Correct Answer:
Verified

True

Given the data cleanup problem described in the text, write the pseudocode for the converging-pointers algorithm for data cleanup.

Free
(Essay)
4.8/5
(34)
Correct Answer:
Verified

1. Get values for n and the n data items
2. Set the value of legit to n
3. Set the value of left to 1
4. Set the value of right to n
5. While left is less than right do Steps 6 through 10
6. If the item at position left is not 0 then increase left by 1
7. Else (the item at position left is 0) do Steps 8 through 10
8. Reduce legit by 1
9. Copy the item at position right into position left
10. Reduce right by 1
11. If the item at position left is 0, then reduce legit by 1
12. Stop

____ are useful for rating one machine against another and for rating how sensitive a particular algorithm is with respect to variations in input on one particular machine.

Free
(Multiple Choice)
4.8/5
(43)
Correct Answer:
Verified

B

Given a sorted list, the sequential search algorithm is more efficient than the binary search.

(True/False)
4.9/5
(37)

If an Q(n²) algorithm and an Q(n) algorithm exist for the same task, then for large enough n, the Q(n²) algorithm does more work and takes longer to execute, regardless of the constant factors for peripheral work.

(True/False)
4.7/5
(42)

Sequential search is a(n) ____ algorithm in the worst case.

(Multiple Choice)
5.0/5
(36)

Discuss at length both the best and worst case of the pattern-matching algorithm.

(Essay)
4.8/5
(45)

____________________ is the term to describe an algorithm's careful use of resources.

(Short Answer)
4.7/5
(37)

Problems for which no known polynomial solution algorithm exists are sometimes approached via ____ algorithms.

(Multiple Choice)
4.9/5
(29)

In the sequential search algorithm, the worst case occurs when the value being searched for is the ____ value in the list.

(Multiple Choice)
4.9/5
(39)

____ is the algorithmic equivalence of style.

(Multiple Choice)
4.8/5
(29)

Binary search uses significantly more space than sequential search.

(True/False)
4.8/5
(35)

Explain the sentence: The selection sort algorithm not only does comparisons; it also does exchanges.

(Essay)
4.9/5
(33)

First and foremost, we expect elegance from our algorithms. _________________________

(True/False)
4.8/5
(33)

In the sequential search algorithm, the worst case occurs when the value being searched for is the first value in the list. _________________________

(True/False)
4.8/5
(28)

The properties that make better algorithms are very similar to the properties we look for when purchasing a car.

(True/False)
4.9/5
(35)

If an algorithm is more time efficient and less space efficient, what is this called?

(Short Answer)
4.9/5
(35)

Part of the job of program ____ is to make clear any assumptions or restrictions about the input size the program was designed to handle.

(Multiple Choice)
5.0/5
(35)

The shuffle-left algorithm is not space-efficient. _________________________

(True/False)
4.9/5
(44)

The number of comparisons done by the selection sort algorithm does not grow at the same rate as the problem size n, instead it grows at approximately the ____________________ of that rate.

(Short Answer)
4.9/5
(34)
Showing 1 - 20 of 50
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)