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
Markup is BEST defined as:
Finger [1]
The amount of money added to the product by the seller, difference between the cost price and selling price 
6 0
3 years ago
Write a program that will accept n number of integers from the keyboard. When the loop exits output the largest and smallest val
Andre45 [30]

Answer:

Explanation:

n = eval(input('Enter # of number you want to enter: '))

list_=[]

for i in range(n):

   number = eval(input("enter number: "))

   list_.append(number)

   if i == n-1:

       maximum = max(list_)

       minimum = min(list_)

       print("maximum : "+str(maximum))

       print("minimum : "+str(minimum))

   

6 0
3 years ago
Write an expression using membership operators that prints "Special number" if special_num is one of the special numbers stored
Mashcka [7]

Answer:

In python, the statement can be written as:

<em>if(special_num in special_list): print("Special Number") </em>

Explanation:

We need to create a list with the name 'special_list' with some values and then check whether special_num is in the list or not using the membership operator.

Membership operator in python: <em>in</em>

Let us do it step by step in python:

<em>special_list = ['1', '2', '3','4']      #</em>A list with the values 1, 2, 3 and 4

<em>special_num = input("Enter the number to be checked as special \t") </em>

<em>#</em>Taking the input from the user in the variable special_num.

<em>if(special_num </em><em>in</em><em> special_list): print("Special Number") </em>

#Using the membership operator <em>in </em>to check whether it exists in the list or not.

Please refer to the image attached for the execution of above program.

So, the answer is:

In python, the statement can be written as:

<em>if(special_num in special_list): print("Special Number") </em>

6 0
3 years ago
The memory address that is saved by the system when a method is called and is the location to which the system should return aft
MA_775_DIABLO [31]

Answer:

Return point

Explanation:

4 0
2 years ago
Quadratic equation 4
SSSSS [86.1K]

In algebra, a quadratic equation is any equation that can be rearranged in standard form as ax^{2}+bx+c=0 where x represents an unknown, and a, b, and c represent known numbers, where a ≠ 0. If a = 0, then the equation is linear, not quadratic, as there is no ax^2 term.

HOPE IT HELPS:)

7 0
3 years ago
Other questions:
  • Ximena noticed that Sofia had created a network bridge on her new laptop between the unsecured wireless network and the organiza
    15·1 answer
  • You have been hired to set up a network for XYZ Enterprises. What factors will you consider to determine the type of network nee
    7·2 answers
  • What is a quick way to determine if a site might contain reliable information?
    5·2 answers
  • Microsoft's
    8·1 answer
  • What are the ASE special certifications?
    14·2 answers
  • What type of engineer is interested in designing, developing, and building different machines, devices, and tools? A.aerospace
    8·2 answers
  • The product of two integers is -180 if one of them is 12 find the other​
    14·1 answer
  • Serena, an analyst at an environmental agency, wants to prepare a report using data from the Car Emissions database.
    11·2 answers
  • What can you use to make sure that you have no errors in Word Online?
    5·1 answer
  • Cybersquatters:_________.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!