Computer Science: An Overview (13th Edition) (What's New in Computer Science)
13th Edition
ISBN: 9780134875460
Author: Glenn Brookshear, Dennis Brylow
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 12, Problem 35CRP
Explanation of Solution
Identify the points of non-determinism in the following
- It can be done by considering the statement “Select three numbers between 1 and 100.” This instruction is ambiguous as it does not clearly mention which of the three elements are selected.
- The condition for the selection of numbers is not provided in the statement.
- The three numbers should be selected by the user in such a way that the sum can be greater than 150 or less than 50.
- The selection of three numbers depends on the user.
- Consider another statement “Select one of the chosen numbers and give the number and give that number as the answer...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
The greatest common divisor of two positive integers, A and B, is the largest number that can be evenly divided into both of them. Euclid's algorithm can be used to find the greatest common divisor (GCD) of two positive integers. You can use this algorithm in the following manner:
1. Compute the remainder of dividing the larger number by the smaller number.
2. Replace the larger number with the smaller number and the smaller number with the
remainder.
3. Repeat this process until the smaller number is zero.
The larger number at this point is the GCD of A and B. Write a program that lets the user enter two integers and then prints each step in the process of using the Euclidean algorithm to find their
GCD.
An example of the program input and output is shown below:
Enter the smaller number: 5
Enter the larger number: 15
The greatest common divisor is 5
Q/The following algorithm is to
find and print the factorial of
ten numbers, which of the
following options are true?
)1( ابدا
)2( ضع قيمة 1=N
)3( ضع قيمة 1=F
)4( اقرا قيمة العد د x
)5( افتح حلقة تكرار بقيمة ابتدائية 1=J وقيمة نهائية x وزيادة مقدارها 1
)6( أحسب قيمة F من المعادلة *F=F
)7( عد إلى الخطوة رقم 5 لحين وصول العداد لقيمته النهائية
)8( اطيع قيمة x و F
)9( اضف قيمة واحد إلى العداد 1+N=N
)10( إذا كانت قيمة 10=>N اذهب إلى الخطوة 3 والا اذهب إلى الخطوة 1 1
)1 1( توقف
الخطوة 4 يجب أن تكون قبل الخطوة 3 لتكون
الخوارزمية صحيحة
الخطوة 3 يجب أن تكون بعد الخطوة 5 لتكون
الخوارزمية صحيحة
0 الخوارزمية صحيحة تماما
الخطوة 9 يجب أن تكون قبل الخطوة 8 لتكون
الخوارزمية صحيحة
)5( يوجد خطأ في الخطوة 10
Write an algorithm that computes the Body Mass Index (BMI) given the heights and weights of students. The algorithm should first read the total number of students and then read the height and weight of each student to calculate and print the BMI category A student is considered Underweight if the BMI is less than or equal to 18.5; Normal Weight if between 18.5 and 24.9; Overweight if between 25 and 29.9; and Obese if greater than or equal to 30.
Chapter 12 Solutions
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Ch. 12.1 - Prob. 1QECh. 12.1 - Prob. 2QECh. 12.1 - Prob. 3QECh. 12.1 - Prob. 4QECh. 12.2 - Prob. 1QECh. 12.2 - Prob. 2QECh. 12.2 - Prob. 3QECh. 12.2 - Prob. 4QECh. 12.2 - Prob. 5QECh. 12.3 - Prob. 1QE
Ch. 12.3 - Prob. 3QECh. 12.3 - Prob. 5QECh. 12.3 - Prob. 6QECh. 12.4 - Prob. 1QECh. 12.4 - Prob. 2QECh. 12.4 - Prob. 3QECh. 12.5 - Prob. 1QECh. 12.5 - Prob. 2QECh. 12.5 - Prob. 4QECh. 12.5 - Prob. 5QECh. 12.6 - Prob. 1QECh. 12.6 - Prob. 2QECh. 12.6 - Prob. 3QECh. 12.6 - Prob. 4QECh. 12 - Prob. 1CRPCh. 12 - Prob. 2CRPCh. 12 - Prob. 3CRPCh. 12 - In each of the following cases, write a program...Ch. 12 - Prob. 5CRPCh. 12 - Describe the function computed by the following...Ch. 12 - Describe the function computed by the following...Ch. 12 - Write a Bare Bones program that computes the...Ch. 12 - Prob. 9CRPCh. 12 - In this chapter we saw how the statement copy...Ch. 12 - Prob. 11CRPCh. 12 - Prob. 12CRPCh. 12 - Prob. 13CRPCh. 12 - Prob. 14CRPCh. 12 - Prob. 15CRPCh. 12 - Prob. 16CRPCh. 12 - Prob. 17CRPCh. 12 - Prob. 18CRPCh. 12 - Prob. 19CRPCh. 12 - Analyze the validity of the following pair of...Ch. 12 - Analyze the validity of the statement The cook on...Ch. 12 - Suppose you were in a country where each person...Ch. 12 - Prob. 23CRPCh. 12 - Prob. 24CRPCh. 12 - Suppose you needed to find out if anyone in a...Ch. 12 - Prob. 26CRPCh. 12 - Prob. 27CRPCh. 12 - Prob. 28CRPCh. 12 - Prob. 29CRPCh. 12 - Prob. 30CRPCh. 12 - Prob. 31CRPCh. 12 - Suppose a lottery is based on correctly picking...Ch. 12 - Is the following algorithm deterministic? Explain...Ch. 12 - Prob. 34CRPCh. 12 - Prob. 35CRPCh. 12 - Does the following algorithm have a polynomial or...Ch. 12 - Prob. 37CRPCh. 12 - Summarize the distinction between stating that a...Ch. 12 - Prob. 39CRPCh. 12 - Prob. 40CRPCh. 12 - Prob. 41CRPCh. 12 - Prob. 42CRPCh. 12 - Prob. 43CRPCh. 12 - Prob. 44CRPCh. 12 - Prob. 46CRPCh. 12 - Prob. 48CRPCh. 12 - Prob. 49CRPCh. 12 - Prob. 50CRPCh. 12 - Prob. 51CRPCh. 12 - Prob. 52CRPCh. 12 - Prob. 1SICh. 12 - Prob. 2SICh. 12 - Prob. 3SICh. 12 - Prob. 4SICh. 12 - Prob. 5SICh. 12 - Prob. 6SICh. 12 - Prob. 7SICh. 12 - Prob. 8SI
Knowledge Booster
Similar questions
- 3. Is the following algorithm deterministic? Explain your answer. def mystery (Number): if (Number > 0): else: Answer "yes" pick a value less than 5 and give this number as the answerarrow_forwardExplain Algorithm: To sequentially search for the first occurring even number in the list of numbers given.Input 1: –1, 3, 5, 7, –5, 7, 11, –13, 17, 71, 21, 9, 3, 1, 5, –23, –29, 33, 35, 37, 40.Input 2: 6, 17, 71, 21, 9, 3, 1, 5, –23, 3, 64, 7, –5, 7, 11, 33, 35, 37, –3, –7, 11.Input 3: 71, 21, 9, 3, 1, 5, –23, 3, 11, 33, 36, 37, –3, –7, 11, –5, 7, 11, –13, 17, 22.arrow_forwardQuestion-1 Friend's Party Circle: There are a few friends living in the same area. They have a party every weekend and the place of party change each week. It is always a lifficult task to select a place which is nearest for everyone. They advantage of Computer Science to solve this problem. all decided to take Names of friends are Ahmed, Rehman, Careem, Basit, Dawood, Ghani, and Farid. Ahmed lives at 5 minutes' walk from rehman and at 10 minutes' walk from Careem. Careem lives at 3 minutes' walk from Dawood. Rehman lives at 4 minutes' walk from Basit and 2 minutes' walk from Dawood. Dawood lives at two minutes' walk from Farid. Ghani lives at 2 minutes' walk from Basit. a. If we represent a graph G = V (V, E) in which set of vertices are home of each Friend and an edge represents a path between two homes. Provide the adjacency matrix of directed graph of the graph G. b. In above directed graph G. You are required to devise an algorithm to find all possible paths.arrow_forward
- Celebrity problem A celebrity among a group of n people is a person who knows nobody but is known by everybody else. The task is to identify a celebrity by only asking questions to people of the form: ”Do you know him/her?” Solution Select two people from the group given, say, A and B, and ask A whether A knows B. If A knows B, remove A from the remaining people who can be a celebrity; if A doesn’t know B, remove B from this group. Solve the problem recursively for the remaining group of people who can be a celebrity Which design strategy does the following solution use? A-)Decrease-by-a-constant factor algorithm B-)Variable-size-decrease algorithm C-)Decrease-by-a-constant algorithm D-)Divide-and-Conquerarrow_forwardNote:- Do not provide handwritten solution. Maintain accuracy and quality in your answer. Take care of plagiarism.Answer completely.You will get up vote for sure.arrow_forwardPlease assist with problem.arrow_forward
- Write an algorithm that prompts the user for the radius, in inches, and price of a pizza, and then reads in those values. Finally, have the algorithm compute and output the pizza’s cost per square inch.arrow_forwardWrite a pricing algorithm for item A and the amount you bought. The algorithm shows the cost, including a sales tax of 6 percent.arrow_forwardCheck Your Progress: 1. Write the algorithm to find the product of the two numbers.arrow_forward
- The greatest common divisor of two positive integers, A and B, is the largest number that can be evenly divided into both of them. Euclid’s algorithm can be used to find the greatest common divisor (GCD) of two positive integers. You can use this algorithm in the following manner: Compute the remainder of dividing the larger number by the smaller number. Replace the larger number with the smaller number and the smaller number with the remainder. Repeat this process until the smaller number is zero. The larger number at this point is the GCD of A and B. Write a program that lets the user enter two integers and then prints each step in the process of using the Euclidean algorithm to find their GCD. An example of the program input and output is shown below: Enter the smaller number: 5 Enter the larger number: 15 The greatest common divisor is 5arrow_forwardCorrect answer will be upvoted else downvoted. Computer science. You have two positive integers an and b. You can perform two sorts of tasks: a=⌊ab⌋ (supplant a with the integer part of the division among an and b) b=b+1 (increment b by 1) Track down the base number of activities needed to make a=0. Input The primary line contains a solitary integer t (1≤t≤100) — the number of experiments. The main line of the depiction of each experiment contains two integers a, b (1≤a,b≤109). Output For each experiment, print a solitary integer: the base number of activities needed to make a=0.arrow_forwardQUESTION 8 The following algorithm construct a sequence of positive whole numbers, which demonstrates the famous Collatz's conjecture: starting from any positive whole number, the sequence will eventually go down to 1. 1. input: positive integer x 2. i+0 3. repeat 3.1. i+i+1 3.2. if x is odd then 3.2.1. x (3 x x) + 1 else 3.2.2. x x+ 2 until x = 1 4. output i By tracing the algorithm, how many times does the algorithm perform Step 3.2.1. if the input is set to x = 6?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT