1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
eimsori [14]
3 years ago
11

In a List of Positive Integers, Set MINIMUM to 1. For each number X in the list L, compare it to MINIMUM. If X is smaller, set M

INIMUM to X.” Read this STATEMENT very carefully and Answer the below Questions.
A. Will this Algorithm RUN?? Yes or No with a justification

B. Will X Replace Any Value or Not?
Computers and Technology
1 answer:
Dvinal [7]3 years ago
4 0

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The given problem scenario is:

In a List of Positive Integers, Set MINIMUM to 1. For each number X in the list L, compare it to MINIMUM. If X is smaller, set MINIMUM to X.

The answer to question A is: this algorithm will not run because:

If you a list of a positive number and you have already set it MINIMUM to 1, the comparison result with MINIMUM will not obtain. For example, lets suppose a list of numbers L. L={1,2,3,1,1,5,4,3,2}. You have already set the Minimum to 1. When you compare each number X in the list, if X >MINIMUM, then set MINIMUM to X.  

This will not work, because there are positive numbers in the list and the minimum positive number is 1. So the algorithm, will not execute the if-part.

In short, the pseudo-code of this problem is given below:

<em>L={list of positive number e.g. 1,2,3,.......Xn}</em>

<em>MINIMUM=1</em>

<em>foreach ( X in L)</em>

<em>{</em>

<em>(if X<MINIMUM)</em>

<em>    { </em>

<em>        MINIMUM=X</em>

<em>    }</em>

<em>}</em>

The answer to question B is X will not be replaced because X  replaced with MINIMUM only when if-part of this algorithm get executed. However, it is noted that X will not replace any value, if if-part will get executed, the Variable MINIMUM will get replaced with any value.

You might be interested in
Which type of address is the ip address 232. 111. 255. 250?.
Nitella [24]

Answer:

It is either an internal IP address or it is a private IP address.

Explanation:

6 0
2 years ago
If your computer freezes on a regular basis and you checked your hard drive and you have insufficient space you've not installed
lina2011 [118]

First, check that your drivers are up to date. The lag could be caused by outdated drivers that are essential in running your system smoothly. New updates will fix bugs, known errors and will make programs work better and faster. Next, run your anti-virus software to check if malware, spyware, and adware that could be putting your computer at risk by installing hidden files, downloading stuff from the internet and uploading sensitive information from your computer. These unauthorized activities could be eating up your RAM in the background without you knowing and thus making your computer run slowly.

7 0
2 years ago
Read 2 more answers
What does ;-; mean during a text?
zzz [600]

Answer:

Its like an emotionless crying face, mainly used for humor

Explanation:

5 0
3 years ago
Read 2 more answers
Write a function named “createPurchaseOrder” that accepts the quantity (integer), the cost per item(double), and the description
Leona [35]
#include
Program: using namespace std;
string createPurchaseOrder0;
int main(
{
cout<return 0;
}
string createPurchaseOrder(
{
int qty;
double costPerltem;
string description,info="":
cout<<"Enter Quantity:
cin>>qty;
cout<<"Enter cost per item: "
cin>>costPerltem;
cout<<"Enter Description: "
cin>>description;
if(qty<0 I| costPerltem<0
Idescription.compare(''"')==0)
cout<<'InThe entered data is invalid!":
info="":
else
"
cout<<"'InThe entered data is valid!":
info=info+"'(nQuantity: "+to_string (qty) +" In";
info=info+"Cost per item:
"†to_string (costPerltem)+"In";
info=info+"Description: "description+" In";
return info;

Output:
4 0
2 years ago
What is force? what are the types of force ? Explain all with suitable examples<br>​
ad-work [718]
Force is a push or pull which is exerted on an objects. Types of Force are

Contact forces
Non contact forces or At a distance forces

Examples of Contact forces are:
Stretching of the spring of a balance
pushing of a pram
kicking of a football
Pushing the door
Hitting the ball etc are some examples of contact forces.

some types of contact forces are given in the list below:

Applied force
Normal force
Frictional force
Tension force
Air resistance force
Spring force
6 0
3 years ago
Other questions:
  • What are options in the Advanced tab in the Share Workbook dialog box? Check all that apply
    14·2 answers
  • What port does rdp use by default and from what range of numbers should you select a private port number?
    15·1 answer
  • 2. Use inheritance to create a hierarchy of Exception classes -- EndOfSentenceException, PunctuationException, and CommaExceptio
    6·1 answer
  • A(n) ________ is a special value that cannot be mistaken as a member of a list of data items and signals that there are no more
    9·1 answer
  • Next, Leah wants to add a content slide that allows her to insert a table.
    8·2 answers
  • What is the capacity of a disk with two platters, 10,000 cylinders, an average of 400 sectors per track, and 512 bytes per secto
    9·1 answer
  • I
    6·1 answer
  • Zachary drinks 2 cups of milk per day. He buys 6 quarts of milk. How many days will his 6 quarts of milk last?
    12·1 answer
  • Using C, Write a program that reads a series of strings from standard input and prints only those strings beginning with the let
    8·1 answer
  • SOMEONE HELP ME!!!!!
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!