section 8: algorithms - intro to computing

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

B. There is an efficient algorithm for all other NP-complete problems

Which is true if an efficient solution for one NP-complete problem is found? A. The algorithm has exponential runtime B. There is an efficient algorithm for all other NP-complete problems C. Other NP-complete problems are not affected, and don't have efficient algorithms D. The algorithm is incorrect because solving an NP-complete problem is impossible

D. Orange, Peach, Pear, Plum, Tomato

Which list can be searched using binary search? A. Apple, Carrot, Grape, Cucumber, Orange B. Carrot, Banana, Watermelon, Lemon, Lime C. Peach, Nectarine, Plum, Apple D. Orange, Peach, Pear, Plum, Tomato

D. Tupac, Nas, Jay-Z, Eminem, Biggie

Which list is sorted in descending order? A. Biggie, Eminem, Jay-Z, Nas, Tupac B. Tupac, Biggie, Eminem, Jay-Z, Nas C. Tupac, Jay-Z, Nas, Eminem, Biggie D. Tupac, Nas, Jay-Z, Eminem, Biggie

C. Selecting C for every answer

Which describes a heuristic algorithm for taking a multiple-choice exam? A. Answering each question carefully B. Not answering any questions C. Selecting C for every answer D. Not taking the exam

D. Selecting "D. All the above" if it is an option, otherwise selecting C

Which describes an optimized heuristic algorithm for taking a multiple-choice exam? A. Answering each question carefully B. Answer only one question C. Selecting B for every answer D. Selecting "D. All the above" if it is an option, otherwise selecting C

A. Milk and Juice

Which elements need to be swapped to sort the array [Coffee, Milk, Juice, Soda, Tea] in ascending order? A. Milk and Juice B. Milk and Soda C. Coffee and Juice D. Soda and Tea

C. Array of all words / String value for the longest word

Consider the problem of determining the longest word in a list of words with various lengths. What is the problem input / output? A. String value for the longest word / Integer value for the number of words B. String value for the longest word / Array of all words C. Array of all words / String value for the longest word D. Integer value for the number of words / String value for the longest word

A. Finding 18 using linear search

If a list has elements [18, 20, 37, 79, 93], which of the following is the fastest search? A. Finding 18 using linear search B. Finding 18 using binary search C. Finding 93 using linear search D. Finding 93 using binary search

C. 8 µs

If each comparison takes 1 µs (1 microsecond), what is the binary search algorithm's runtime for a list with 128 elements? A. 6 µs B. 7 µs C. 8 µs D. 9 µs

B. 5 seconds

If searching a sock drawer for a matching sock takes at most 5 comparisons, and if each comparison takes 1 second, what is the longest possible runtime for linear search? A. 1 second B. 5 seconds C. 10 seconds D. 25 seconds

B. Short runtime and low memory usage

Which algorithm, based on runtime and memory resources, is the most efficient? A. Short runtime and high memory usage B. Short runtime and low memory usage C. Long runtime and high memory usage D. Long runtime and low memory usage

C. Worst case

The following function returns the first value in a list that is greater than the specified value. If the specified value is 79 and the list is [20, 37, 19, 79, 42, 66, 18], which describes the runtime complexity? A. Best case B. Neither best case nor worst case C. Worst case D. Best and worst case are the same

C. 1 minute

What is the maximum time a linear search algorithm takes if the list has 60,000,000 elements and each comparison takes 1 µs (1 microsecond)? A. 6 microseconds B. 6 seconds C. 1 minute D. 6 minutes

C. S(N) = N + 3

What is the space complexity of the following code, where the list size is 5? A. S(N) = 3 B. S(N) = 5 C. S(N) = N + 3 D. S(N) = N + 5

A. Binary search

Which common algorithm should be used to quickly find Pizza Hut in the phone book? A. Binary search B. Linear search C. Longest common substring D. Shortest path algorithm


Kaugnay na mga set ng pag-aaral

Specialty Disciplines - Psychiatry

View Set

MAR4802-Lesson 02: Company and Marketing Strategy - Partnering to Build Customer Engagement, Value, and Relationships

View Set

Chapter 9 [Relational Database Design by ER- and EERR-to-Relational Mapping]

View Set

Proofs Using Coordinate Geometry

View Set

Comply with Drinking Water Regulations

View Set