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
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.
6- You have two numbers ABCD and WXYZ (ex: 2345 and 7965). Write an algorithm using Pseudocode
that decides whether ABCD is the inverse of WXYZ. (For example, if ABCD is 2356 and WXYZ is 6532
then the algorithm prints "Inverse" otherwise it will print "Not Invers")
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_forwardAlgorithm Analysis Start with 102 coins on a table, 98 showing heads and 4 showing tails. There are two ways to change the coins: • flip over any ten coins, or • place n+ 1 additional coins, all showing tails, on the table where n is the number of heads currently showing on the table. For example, you might begin by flipping nine heads and one tail, yielding 90 heads and 12 tails, then add 91 tails, yielding 90 heads and 103 tails. (a) Model this situation as a state machine, carefully defining the set of states, the start state, and the possible state transitions. (b) Optionally, explain how to reach a state with exactly one tail showing. (c) Consider the following derived variables: C ::= the number of coins on the table H ::= the number of heads on the table T::= the number of tails on the table C, ::= parity (C) H2 ::= parity(H) T2 ::= parity(T) Here the parity : Z → {0,1} function is defined as parity(n) = 0 when n is even and 1 otherwise. Which of these variables is strictly…arrow_forward
- Note:- 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_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 difficult task to select a place which is nearest for everyone. They all decided advantage of Computer Science to solve this problem. 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. b. In above directed graph G. You are required to devise an algorithm to find all possible paths.arrow_forward
- Check Your Progress: 1. Write the algorithm to find the product of the two numbers.arrow_forwardIn what sense does it mean to "choose numbers at random"?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
- Given a positive integer 'n', find and return the minimum number of steps that 'n' has to take to get reduced to 1. You can perform any one of the following 3 steps:1.) Subtract 1 from it. (n = n - 1) ,2.) If its divisible by 2, divide by 2.( if n % 2 == 0, then n = n / 2 ) ,3.) If its divisible by 3, divide by 3. (if n % 3 == 0, then n = n / 3 ). Write brute-force recursive solution for this.Input format :The first and the only line of input contains an integer value, 'n'.Output format :Print the minimum number of steps.Constraints :1 <= n <= 200 Time Limit: 1 secSample Input 1 :4Sample Output 1 :2 Explanation of Sample Output 1 :For n = 4Step 1 : n = 4 / 2 = 2Step 2 : n = 2 / 2 = 1 Sample Input 2 :7Sample Output 2 :3Explanation of Sample Output 2 :For n = 7Step 1 : n = 7 - 1 = 6Step 2 : n = 6 / 3 = 2 Step 3 : n = 2 / 2 = 1 SolutionDp///.arrow_forwardAlgorithms Question Three points P, Q, and R are said to be collinear if they are on a single line. To check whether the 3 points lie on the same line, we use the distance formula. If P, Q and R are three collinear points, then: Distance from P to Q + Distance from Q to R = Distance from P to R PQ + QR = PR The distance between two points (x1, y1) and (x2, y2) is given by Hence, we can easily find the distance between the points P, Q and R, with the help of this formula. Design an algorithm (pseudocode) to check whether three points are collinear. In your solution include the input and the output.arrow_forwardnumbers 4,5,6,7arrow_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