csp unit 6

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Explain the difference between a problem and an algorithm.

A problem is a statement of a task that may or may not be solvable by a computer. An algorithm is a finite set of instructions that accomplish a task.

a finite set of instructions that accomplish a task. (for reference) There are usually many algorithms to solve the same problem, and many ways to write or express one algorithm including natural language, psuedocode, diagrams, and are implemented using programming code. All algorithms can be created by combining steps in three different ways.

Algorithm

a search algorithm that starts at the middle of a sorted set of numbers and removes half of the data; this process repeats until the desired value is found or all elements have been eliminated.

Binary Search

programs are run by multiple devices

Distributed Computing

a measure of how many steps are needed to complete an algorithm

Efficiency

provides a "good enough" solution to a problem when an actual solution is impractical or impossible

Heuristic

Doing some steps over and over

Iteration

a search algorithm which checks each element of a list, in order, until the desired value is found or all elements in the list have been checked.

Linear Search

programs are broken into small pieces, some of which are run simultaneously

Parallel Computing

a general description of a task that can (or cannot) be solved with an algorithm

Problem

Deciding which steps to do next

Selection

Putting steps in an order

Sequencing

programs run in order, one command at a time.

Sequential Computing

the time used to complete a task sequentially divided by the time to complete a task in parallel

Speedup

a problem for which no algorithm can be constructed that is always capable of providing a correct yes-or-no answer

Undecidable Problem

Algorithms with exponential or factorial efficiencies are examples of algorithms that run in an unreasonable amount of time.

Unreasonable Time

The list listOne is a sorted list of numbers that contains 700 elements. The list listTwo is a sorted list of numbers that contains 900 elements. Let x represent the maximum number of list elements that will need to be examined when performing a binary search for a value in listOne, and let y represent the maximum number of list elements that will need to be examined when performing a binary search for a value in listTwo. Which of the following statements about x and y is true? A. The value of x is approximately equal to the value of y. B. The value of x is approximately 10 less than the value of y. C. The value of x is approximately 13 less than the value of y. D. The value of x is approximately 200 less than the value of y.

a

Which of the following efficiencies would be considered unreasonable? a. 2^n b. 2n c. n^2 d. n^20

a

A large number of genetic codes are stored as binary values in a list. Which one of the following conditions must be true in order for a researcher to obtain the correct result when using a binary search algorithm to determine if a given genetic code is in the list? A The genetic codes must be converted from binary to decimal numbers. B The list must be sorted based on the genetic code values. C The number of genetic code values in the list must be a power of 2. D The number of genetic code values in the list must be even.

b

A sorted list of numbers contains 200 elements. Which of the following is closest to the maximum number of list elements that will need to be examined when performing a binary search for a particular value in the list? A. 5 B. 8 C. 100 D. 200

b

A student wants to determine whether a certain problem is undecidable. Which of the following will demonstrate that the problem is undecidable? A Show that for one instance of the problem, an algorithm can be written that is always capable of providing a correct yes-or-no answer. B Show that for one instance of the problem, no algorithm can be written that is capable of providing a correct yes-or-no answer. C Show that for one instance of the problem, a heuristic is needed to write an algorithm that is capable of providing a correct yes-or-no answer. D Show that for one instance of the problem, an algorithm that runs in unreasonable time can be written that is capable of providing a correct yes-or-no answer.

b

A time stamp indicates the date and time that a measurement was taken. A data scientist has a list containing 10,000 time stamps, sorted in chronological order. Which of the following is closest to the maximum number of values that will need to be examined when performing a binary search for a value in the list? A. 10 B. 15 C. 5,000 D. 10,000

b

For which of the following situations would it be best to use a heuristic in order to find a solution that runs in a reasonable amount of time? A Appending a value to a list of nn elements, which requires no list elements be examined. B Finding the fastest route that visits every location among nn locations, which requires n!n! possible routes be examined. C Performing a binary search for a score in a sorted list of nn scores, which requires that fewer than nn scores be examined. D Performing a linear search for a name in an unsorted database of nn people, which requires that up to nn entries be examined.

b

Suppose that a list of numbers contains values [-4, -1, 1, 5, 2, 10, 10, 15, 30]. Which of the following best explains why a binary search should NOT be used to search for an item in this list? A The list contains both positive and negative elements. B The elements of the list are not sorted. C The list contains an odd number of elements. D The list contains duplicate elements.

b

A team of programmers is designing software. One portion of the project presents a problem for which there is not an obvious solution. After some research, the team determines that the problem is undecidable. Which of the following best explains the consequence of the problem being undecidable? A The problem can be solved algorithmically, but it will require an unreasonably long amount of time. B The problem can be solved algorithmically, but it will require an unreasonably large amount of data storage. C There is no possible algorithm that can be used to solve all instances of the problem. D There are several different possible algorithms that can solve the problem, but there is controversy about which is the most efficient.

c

In which of the following situations is it most appropriate to use a heuristic solution? a. The only algorithms that provide exact solutions run in linear time b. The problem has been identified as undecidable c. The only algorithms that provide exact solutions run in unreasonable time but exact solutions are not necessary d. Two different algorithms have been identified that solve the problem in reasonable time

c

What is the third step using Binary Search to look for the number 32 in this list: 1, 2, 3, 4, 10, 11, 16, 25, 32, 33, 45, 47, 51, 69, 75 a) Compare the number 25 to the given number. b) Compare the number 4 to the given number. c) Compare the number 33 to the given number. d) Compare the number 47 to the given number.

c

For which of the following lists can a binary search be used to search for an item in the list? ["blue", "green", "jade", "mauve", "pink"] [5, 5, 5, 5, 6, 7, 8, 8, 8] [10, 5, 3, 2, -4, -8, -9, -12] A I only B III only C I and III only D I, II, and III

d

Which of the following best explains how algorithms that run on a computer can be used to solve problems? A All problems can be solved with an algorithm that runs in a reasonable amount of time. B All problems can be solved with an algorithm, but some algorithms might need a heuristic to run in a reasonable amount of time. C All problems can be solved with an algorithm, but some algorithms might run in an unreasonable amount of time. D Some problems cannot be solved by an algorithm.

d

Which of the following is true of two algorithms designed to solve the same problem? a. If two algorithms solve the same problem they must have the same efficiency b. If two algorithms solve the same problem they must have different efficiency c. For any given problem there is a single algorithm that can solve it with a single efficiency d. It is possible for two algorithms with different efficiencies to solve the same problem

d

Algorithms with a polynomial efficiency or lower (constant, linear, square, cube, etc.) are said to run in a reasonable amount of time

reasonable time


Kaugnay na mga set ng pag-aaral

Accounting for Factory Overhead - Theories

View Set

EMT - Chapter 32 Orthopaedic Injuries Quiz

View Set

college bio: chapter 2 smartbook

View Set