AP Principles Algorithims

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

Which of these situations is most analogous to parallel computing?

When multiple people work on a jigsaw puzzle, they can each work on a different part of the puzzle. Once each person has put together a significant area of the puzzle, they can merge the areas and see the completed puzzle.

A mathematician comes up with an algorithm to search a matrix for a value. This table shows how many steps the algorithm requires for different matrix sizes: Matrix sizeSteps24416636864 Which function best describes how the number of steps changes as the matrix size (nnn) increases?

n^2

Digi-Clima Grid is a research project that analyzes historical rain intensity records using distributed computing. This chart shows the speedup gained when the Digi-Clima analysis was run on an increasing number of computers: 002244668810101212181624Number of computersSpeedup (vs. 1 computer) A bar graph visualizing the following table: Number of computersSpeedup (versus 1 computer)1185.1166.72410.1 What does the chart demonstrate about the benefits of distributed computing?

Distributed computing can reduce the time it takes to solve large problems.

The United States Postal Service (USPS) delivers nearly 200 million pieces of mail every day. Their website and internal operations are powered by many algorithms. Which algorithm's runtime is most likely to be improved by the use of a heuristic?

Calculating an efficient route for a delivery carrier through a city, considering factors like parking space and mail volume

An online shopping site uses the following algorithm to decide what related products to show on each product page. Flow chart for related products algorithm. The "start" node flows to a diamond node with condition "itemSimilarity > 0.9". From there, an arrow labeled true flows to a node with "showRelated ← true" and an arrow labeled false flows to a diamond node with condition "userSimilarity > 0.8". From that diamond node, an arrow labeled true flows to "showRelated ← true" and an arrow labeled false flows to a diamond node with condition "updatedModel = true". From that diamond node, an arrow labeled true flows to "showRelated ← true" and an arrow labeled false flows to "showRelated ← false". [How do you read a flowchart?] Which pseudocode is equivalent to the algorithm in the flowchart?

IF (itemSimilarity > 0.9 OR userSimilarity > 0.8 OR updatedModel = true) { showRelated ← true } ELSE { showRelated ← false }

Serena operates a security camera that stores still images in timestamped filenames. The camera can generate thousands of images each day, and she needs a way to find the image corresponding to a particular timestamp. She comes up with this algorithm: Start with a list of the image filenames, sorted from oldest to newest. Set min to 1 and max to the number of images. Set index to the average of max and min, rounded down so that it is an integer. Check the filename located at that index in the list. If the filename equals the desired timestamp, the search is done! Exit the algorithm. If the filename is older than the desired timestamp, set min to be one larger than index. If the filename is newer than the desired timestamp, set max to be one smaller than index. Go back to step 3. Which statements are true about this algorithm? 👁️Note that there are 2 answers to this question.

It implements a binary search. It is more efficient than a linear search.

Makayla is developing software for an animal shelter. After some research, she comes up with this algorithm for calculating the number of daily calories required for a dog: Calculate the Resting Energy Requirement (RER) by raising the dog's weight to the 3/4 power and multiplying the result by 70 If the dog is neutered, multiply RER by 1.6 Otherwise, multiply RER by 1.8 After verifying the algorithm comes up with a reasonable number for a single dog, she decides to extend it to compute the total calories needed for all the dogs in the shelter each day. What structure must be added to the original algorithm so that it can compute the calories for multiple dogs? Choose 1 answer:Choose 1 answer:

Iteration

An algorithm will be used to count how many numbers in a list are multiples of either 5 or 10. For the list of [5, 3, 2, 10, 20, 7], it should count 3 numbers (5, 10, 20). There are two proposals for the algorithm: Algorithm 1: Set value of count to 0. Iterate through each number in the list. If the current number is a multiple of 5 and a multiple of 10, increment count by 1. Algorithm 2: Set value of count to 0. Iterate through each number in the list. If the current number is a multiple of 5, increment count by 1. Then, if the current number is a multiple of 10, increment count by 1. Which of the following best describes the behavior of these algorithms?

Neither algorithms will output the correct count on all inputs, due to issues with under-counting or over-counting multiples.


Kaugnay na mga set ng pag-aaral

Chapter 7: Cell Structure and Function

View Set

8.1.2 Quiz: What is Personal Property

View Set

Health, Wellness, and Illness - Functional Ability - Concept (HESI)

View Set

ТАБЛИЦА СЛОВООБРАЗОВАНИЯ (F)

View Set

career exploration and research quiz

View Set