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
3241004551 [841]
3 years ago
5

Find the max and min of a set of values using recursion Find the max and min of a set of values using recursion. First input the

values. The first value inputted is the number of additional data items to input. For instance, if the input is: 3 1 2 3
Computers and Technology
1 answer:
matrenka [14]3 years ago
4 0

Answer:

This question is answered using Python programming language

def MaxSet(mylist, count):  

     if (count == 1):  

           return mylist[0]  

     return max(mylist[count - 1], MaxSet(mylist, count - 1))  

def MinSet(mylist, count):  

     if (count == 1):  

           return mylist[0]  

     return min(mylist[count - 1], MinSet(mylist, count - 1))  

count = int(input("Length of set: "))

mylist = []  

for i in range(count):

     inp= int(input("Input: "))

     mylist.append(inp)

   

print("Minimum: "+str(MinSet(mylist, count)) )

print("Maximum: "+str(MaxSet(mylist, count)) )

Explanation:

This defines the recursion that returns the maximum

def MaxSet(mylist, count):  

This following checks for the maximum using recursion

<em>      if (count == 1):  </em>

<em>            return mylist[0]  </em>

<em>      return max(mylist[count - 1], MaxSet(mylist, count - 1))  </em>

This defines the recursion that returns the minimum

def MinSet(mylist, count):  

This following checks for the minimum using recursion

<em>      if (count == 1):  </em>

<em>            return mylist[0]  </em>

<em>      return min(mylist[count - 1], MinSet(mylist, count - 1))  </em>

The main begins here

This prompts user for length of set

count = int(input("Length of set: "))

This defines an empty list

mylist = []  

The following iteration gets user input

<em>for i in range(count): </em>

<em>      inp= int(input("Input: ")) </em>

<em>      mylist.append(inp) </em>

This calls the minimum function    

print("Minimum: "+str(MinSet(mylist, count)) )

This calls the maximum function

print("Maximum: "+str(MaxSet(mylist, count)) )

You might be interested in
When was the speaker invented?
wlad13 [49]

Answer:

Explanation:

1876

4 0
3 years ago
Read 2 more answers
Question _.1 with 1 blankMiguel y Maru están muy cansados. Question 2 with 1 blankFelipe es muy joven. Question 3 with 1 blankJi
Alekssandra [29.7K]

Answer:

Miguel y Maru están muy cansados.  - Miguel y Maru están cansadísimos

Felipe es muy joven. - Felipe es jovencísimo

Jimena es muy inteligente. - Jimena es inteligentísima

La madre de Marissa está muy contenta. - La madre de Marissa está contentísima

Estoy muy aburrido. - Estoy aburridísimo

Explanation:

In this activity we have to switch the statements to the absolute superlative of the expressions. In Spanish we can add the suffix -ísimo to an adjective to refer to the highest degree of something. It can be translated in ENglish to "really, extremely, super or quie". The statements in English are:

- Miguel and Maru are very tired - Miguel and Mary are extremely tired

- Felipe is very young - Felipe is super young

- Jimena is very smart - Jimena is really smart

- Marissa´s mother is very happy - Marissa´s mother is extremely happy

- I´m very bored - I´m super bored

8 0
4 years ago
Make the smallest
seraphim [82]

Answer:

<em>Whole Numbers:</em>

0000 0001 (Binary) --> 1 (Decimal)

<em>Real Numbers:</em>

0000 0001 (Binary) -->  0.00390635 (Decimal)

Explanation:

In general, the smallest nonzero number that can be displayed in binary that is a whole number is 1.  Consider that as you increase by 1 in the binary system starting from 0, you will have the following:

0000 0000 == 0

0000 0001 == 1 (Smallest nonzero)

0000 0010 == 2

0000 0011 == 3

... etc.

Notice the smallest value here is decimal 1.  With this in mind, you will need to "program" you Flippy Do Pro to display this value.  Alternatively, if you consider decimal numbers in binary with the Flippy Do Pro, you can have even smaller nonzero numbers.  Depending on where you decide to place the decimal, you can even have smaller nonzero values.

Let's assume that you say this is a fractional representation of binary on the Flippy Do Pro.  Then, you will say your decimal is infront of the display of the Flippy Do Pro, hence index 9 (which is not displayed).  From here, you will simply say the following:

0000 0000 == 0.0

0000 0001 == 0.00390635 (Smallest nonzero)

0000 0010 == 0.0078125

0000 0100 == 0.015625

... etc.

Note, in binary, as you move the value of 1 to the right of the decimal, you are doing (1 / 2^n), where n is the index value to the right of the decimal.

Hence, depending on if you are to consider just whole numbers or real numbers, the smallest value displayed can be different even though the number being displayed is still 0000 0001.

Cheers.

3 0
3 years ago
Help me with ic3!!!!!!!
Scilla [17]

1. Locally 2. Codec 3. Analog, Digital 4. ISP 5.

4 0
3 years ago
What are the features of the Outline view in Word? Select three options.
Rina8888 [55]

Answer:

making it easier to deal with larger documents

manipulating headings

changing data inside headings

Explanation:

Outline view in Word helps you manage and focus on a document’s structure and headings when you have a complex and huge document to organize. You can use this view to create or edit headings, move text around, change heading levels, and control the amount of details you see.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Assume that LO and HI have already been assigned as constants with LO &lt; HI, and x has been declared as DWORD in the data segm
    7·1 answer
  • For some reason i cant see brainly answers
    11·1 answer
  • How do you know where the home row of the keyboard is?
    14·2 answers
  • Answer the following questions for Web browser and Web server software: 1. What functions should this software application provi
    7·1 answer
  • If myClass has a constructor with a parameter of type String, select the other constructor that should be included.
    14·1 answer
  • Requirements description:
    6·1 answer
  • A list is a collection that ______________
    9·1 answer
  • Identify the characteristics of logic problems. Select all that apply.
    11·2 answers
  • Active directory and 389 directory server are both compatible with which directory access protocol?
    6·1 answer
  • Which of the following is NOT a best practice to protect data on your mobile computing device?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!