C++ Write a recursive function recursiveMinimum that takes an integer array, a starting subscript, and an ending subscript as arguments and returns the smallest element of the array. The function should stop processing and return when the starting subscript equals the ending subscript.

Answers

Answer 1

Answer:

#include <iostream>

using namespace std;

int recursiveMinimum(int array[], int start, int end) {

 if (start == end) {

   return array[start];

 }

 return min(array[start], recursiveMinimum(array, start+1, end));  

}

int main() {

 int array[] = { 3, 7, 2, 23, 6, 1, 33, 88, 2 };

 int nrElements = sizeof(array) / sizeof(array[0]);

 cout << "The smallest value is "

   << recursiveMinimum(array, 0, nrElements-1) << endl;

}

Explanation:

The recursive function will compare the element at the start of the range to the minimum of the rest of the range [start+1, end].

An end criterium for the recursion is always very important. It is the comparison start==end.


Related Questions

3-2: Using Libraries: The C++ language includes functions organized into a series of libraries. Your text documents some of these libraries in Appendix F. Part A Refer to the functions contained in the cmath (math.h) library. Identify a function that will find the absolute value of a number. Indicate how many pieces of data must be passed to the function. Indicate, what (if anything) will be returned by the function. Demonstrate the appropriate use of the function in a short code fragment. Part B Refer to the functions contained in the cmath (math.h) library. Identify a function that will determine the value of x raised to the y power. Indicate how many pieces of data must be passed to the function. Indicate, what (if anything) will be returned by the function. Demonstrate the appropriate use of the function in a short code fragment.

Answers

The cmath (math.h) library's abs function can be used to determine a number's absolute value (). The integer whose absolute value has to be determined is the only piece of data that must be supplied to the function.

Is there an absolute value for cmath?

In C++, the abs() method returns the argument's absolute value. It is specified in the header file for cmath. In mathematics, abs(num) equals |num|.

cmath> is included.

Including the iostream tag.

-10; int abs num; int main(); int num; The absolute value of num is "" abs num std::endl; return 0; "" std::abs(num); std::cout;

To know more about data visit:-

https://brainly.com/question/13650923

#SPJ1

A good administrative position to acquire as a stepping stone to further positions is

Answers

Answer:

A good administrative position to acquire as a stepping stone to future positions is an intern.

Explanation:

When an individual is an intern within an administrative sector, he will be able to learn many concepts and guidelines of this type of work, getting involved in various areas within the sector and accumulating knowledge that will serve him to occupy greater positions within the sector.

In this case, being a trainee is a better option due to the exchange of areas in which he can participate and which will show where his greatest capacities are concentrated within an administrative sector.

You have a hard disk in a Windows system configured as a basic disk. You need to create six volumes on the disk. Which of the following partition types must you create?
a. primary
b. system
c. extended
d. dynamic

Answers

The MBR partition scheme allows you to create up to four partitions on a basic disk: either four primary partitions or three primary and one extended partition. Initial division, You can create up to four primary partitions on a basic drive. Thus, option C is correct.

What Windows system configured as a basic disk?

First partition On a basic drive, you can make up to four primary partitions. A primary partition must exist on each hard drive before a logical volume can be created. Only one partition can be made the active partition.

Therefore, One or more logical drives can be found in the extended partition.

Learn more about disk here:

https://brainly.com/question/27960878

#SPJ1

flow chart to read 50 numbers and print summation of even numbers only

Answers

The sum of terms in an arithmetic progression formula is used to get the sum of even numbers formula. Sum of Even Numbers Formula is written as n(n+1), where n is the total number of entries in the series.

What is print summation of even numbers only?

Python comes with a built-in method called sum() that adds up the values in the list. Syntax: sum (iterable, start) (iterable, start) Iterable:

Most importantly, iterable should be numbers. Start: This start is added to the total of the iterable's numbers.

Therefore, By definition, when a number is divided by two, there is never a remainder. There will therefore be no residue when it is added to another even integer.

Learn more about summation here:

https://brainly.com/question/29334900

#SPJ1

please help!!!! what is the meaning of M,I,C,R,O,S,O,F,T word?
M-
I-
C-
R-
O-
S-
O-
F-
T-​

Answers

Answer:

Microsoft (the word being a portmanteau of "microcomputer software") was founded by Bill Gates and Paul Allen on April 4, 1975, to develop and sell BASIC interpreters for the Altair 8800. It rose to dominate the personal computer operating system market with MS-DOS in the mid-1980s, followed by Microsoft Windows

Explanation:

if you need full answer this is it

public class Exercise_07 { public static void main(String[] args) { System.out.println(bin2Dec("1100100")); // Purposely throwing an exception... System.out.println(bin2Dec("lafkja")); } public static int bin2Dec(String binary) throws NumberFormatException { if (!isBinary(binary)) { throw new NumberFormatException(binary + " is not a binary number."); } int power = 0; int decimal = 0; for (int i = binary.length() - 1; i >= 0; i--) { if (binary.charAt(i) == '1') { decimal += Math.pow(2, power); } power++; } return decimal; } public static boolean isBinary(String binary) { for (char ch : binary.toCharArray()) { if (ch != '1' && ch != '0') return false; } return true; } }

Answers

Answer:

mhm

Explanation:mhm

what does any of this mean?

Python task
Enter 8 grades of the student received by him during the study of the topic. Determine the student's average grade for the topic. Determine how many marks are higher than 50.

Answers

Enthalpy Changes the overall energy change in the substance portrayed in the graph at  48°C.

What are the data that were obtained from the question?

Mass (m) = 0.3 Kg

Initial temperature (T1) = 20°C

Heat (Q) added = 35 KJ

Specific heat capacity (C) = 4.18 KJ/Kg°C

Final temperature (T2)

The final temperature of water can be obtained as follow:

Q = MC(T2 – T1)

35 = 0.3 x 4.18 (T2 – 20)

35 = 1.254 (T2 – 20)

Clear the bracket

35 = 1.254T2 – 25.08

Collect like terms

1254T2 = 35 + 25.08

1.254T2 = 60.08

Divide both side by the coefficient of T2 i.e 1.254

T2 = 60.08/1.254

T2 = 47.9 ≈ 48°C

Therefore, the final temperature of the water is 48°C.

Learn more about temperature on:

https://brainly.com/question/11464844

#SPJ1

please note, my working hours may be different than yours. please don't feel obligated to respond outside of your normal business hours unless necessary.

Answers

A statement "please note, my working hours may be different than yours. please don't feel obligated to respond outside of your normal business hours unless necessary." this means that more benefit to change to flexible work.

What is flexible work?

Individual behavior describes the behaviors, responses, reactions, and ways in which a person behaves when they are in a certain situation. It consists of a variety of reactions to both internal and external stimuli. Individual habits and actions are frequently linked, either because of time restraints, resource accessibility, social connections, or biological inclinations. For instance, drinkers are more likely to smoke than non-drinkers, and physically unfit people are also less likely to make an effort to prepare meals at home.

Learn more about flexible work: https://brainly.com/question/29316477

#SPJ4

How is a struck-by rolling object defined?

Answers

Sorry I don’t know I just needed points to ask my question

Answer:

Struck by rolling object is commonly defined as Struck-By Rolling Object Hazard because it was caused by rolling objects or any objects that moves in circular motion that could cause an injury or accident.

Explanation:

What is the first step you should take when you want to open a savings account? A. Present your photo ID to the bank representative. B. Go to the bank and fill out an application. C. Make your initial deposit. D. Review the different savings account options that your blunk offers.​

Answers

Answer: B

Explanation:

The first step you should take when you want to open a savings account is the photo id

Debbie can use the feature in the email to copy her manager on the email without her colleague knowing she did so

Answers

Debbie can use the BCC feature (Blind Carbon Copy)

write a flowchart to determine a student final grade and indicate is pass or fail, the final grade is calculated as the average of 4 marks​

Answers

Here is the flowchart's text-based depiction. Start, input four notes, calculate the average, and check to see if it is greater than 50. IF YES, OUTPUT "Pass" and the score for the test. IF NOT: PUBLISH "Fail" and the final score -> CONCLUSION.

How is the ultimate grade determined?

Add up all of your grades to get your total college course grade. (except the final exam). then tally up all of the points that can be earned. (except your final exam). Divide your overall score by the total number of points available.

What is the pass/fail ratio?

A C is a score that falls somewhere in the middle. Between 59% and 69% F is a failing mark, and C is anywhere between 70% and 79% D, which is still a passing grade.

To know more about flowchart visit:

https://brainly.com/question/31293561

#SPJ9

what is meant by resources of computer

Answers

This question is not specific enough. However, a computer helps you listen to music, read articles and even novels, draw using online platforms, play games, etc.

In an exam of JEE one aspirant got P correct answers, Q wrong answer, and R unattempted question. If the mark for the correct answer is 4, for the wrong answer is -2, and for the unattempted questions is -1. Find the final marks the aspirant got.

Answers

The tοtal marks scοred by the aspirant is  4P - 2Q - R.

What are the three marks on a class exam for?

In a class test, each right response receives (+3) points, every incorrect response receives (2) points, and there are no points awarded for not attempting any questions.

The final percentage formula used to determine a candidate's score on the JEE exam based on the number of questions attempted, correct answers, and incorrect responses.

Given marks fοr cοrrect answer is 4

                   fοr the wrοng answer is -2

            and fοr the unattempted questiοns is -1

Given aspirant gοt cοrrect answers =P

                                 wrοng answer =Q

            and unattempted questiοn =R

Then the tοtal marks scοred by the aspirant is  

= (P × 4) + (Q × (-2)) +(R (-1))

= 4P - 2Q - R.

To know more about percentage visit:

brainly.com/question/30903100

#SPJ9

What should Lee do to accomplish this task? Check all
that apply.
Add shading to the top row.
Change the style of the table.
Bold the names of the planets.
Increase the font size of all the text.
Increase the overall size of the table.

What should Lee do to accomplish this task? Check allthat apply.Add shading to the top row.Change the

Answers

Answer:

Add shading to the top row.

Change the style of the table.

Explanation:

Changing the shading can make it easier to see and the style will make it stand out therefore making easier to read and it stands out.

Answer:

a,b

Explanation:

System testing – During this stage, the software design is realized as a set of programs units. Unit testing involves verifying that each unit meets its specificatio

Answers

System testing is a crucial stage where the software design is implemented as a collection of program units.

What is Unit testing?

Unit testing plays a vital role during this phase as it focuses on validating each unit's compliance with its specifications. Unit testing entails testing individual units or components of the software to ensure their functionality, reliability, and correctness.

It involves executing test cases, evaluating inputs and outputs, and verifying if the units perform as expected. By conducting unit testing, developers can identify and rectify any defects or issues within individual units before integrating them into the larger system, promoting overall software quality.

Read more about System testing here:

https://brainly.com/question/29511803

#SPJ1

Which statement correctly explains why televisions became less bulky?

Answers

Answer:

The old cathode Ray tube technology was replaced by the less bulkier and more modern liquid crystal display and LED technology.

Explanation:

The old cathode ray tube uses the principle of electrical discharge in gas. Electrons moving through the gas, and deflected by magnetic fields, strike the screen, producing images and a small amount of X-rays. The tube required more space, and consumed more electricity, and was very bulky. The modern technologies are more compact and consume less power, and can been designed to be sleek and less bulky.

Which of the following statements is something the operations system of a computer is responsible for doing? Managing memory allocation for all apps.
Providing a way for the user to create text docs
allowing the user to access the internet.
Allowing the user to write programs

Answers

Explanation:

took the test

Which of the following statements is something the operations system of a computer is responsible for

The statement "Managing memory allocation for all apps" is something the operations system of a computer is responsible for doing. So, option 1 is true.

Ask about the statements that are something the operations system of a computer is responsible for doing.

The operating system handles memory management, ensuring that different applications have appropriate memory allocation and can efficiently utilize system resources.

It is not directly responsible for providing a way to create text documents, accessing the internet, or allowing the user to write programs, although these functionalities can be facilitated by certain applications or tools within the operating system.

Therefore, option 2 is true.

To know more about the operating system visit:-

https://brainly.com/question/30692693

#SPJ3

The _______ within a story are the people and/or objects that the story is about

A. Timeline
B. Plot
C. Characters
D. Setting

Answers

Answer:

c

Explanation:

thats who the story and book is about

C characters lol :) it’s C

In which cloud service model, virtual machines are provisioned? Iaas

Answers

Answer:

SaaS is the cloud service in which virtual machines are provisioned

What are url addresses for visiting websites? And what are the different parts of a URL? Answer it in a 1-2 paragraph

Answers

A URL is a website link which consists of //https and the title of the website you are going to. A URL helps guide and memorize certain links and websites. Also some URL links are fake and give false advertisement or false information especially when looking into things that happen everyday like the news. You can tell this by seeing if the url link is a trustworthy link. I hope this helps maybe you can expand on it if it’s not long enough

Answer:

Please read explanation

Explanation:

URL is the short form for "Uniform Resource Locator". A uniform resource locator tells the location of a website to the browser.

Parts of URL:

There are three main parts of URL

ProtocolDomain nameExtension

Protocol defines the type of protocol used for communicating with the website while the domain name is the name assigned to the IP address and the mapping is stored in domain name server and extension tells the type of website i.e.

.com means commercial

.org means non-profitable organization

.edu means educational website

An additional element is path which change with the website navigation.

Define 'formatting'

Answers

Answer:

Formatting refers to the appearance or presentation of your essay.

Explanation:

Most essays contain at least four different kinds of text: headings, ordinary paragraphs, quotations and bibliographic references.

Formatting refers to the appearance or presentation of your essay. Another word for formatting is layout. Most essays contain at least four different kinds of text: headings, ordinary paragraphs, quotations and bibliographic references.

InfoTrac is an aggregated database?

True

False

Answers

Answer: true

Explanation:

Sir Tim Berners-Lee wrote the three fundamentals for the Web. What are these three fundamentals? Choose the answer. OO HTMT, IP, URL (or URI) HTML, HTTP, URR HTTP, HTML, IP HTML, HTTP, URL (or URI)​

Answers

Answer:

HTML, HTTP, and URI/URI

Explanation:

In 1990, Berners-Lee developed three fundamental technologies: HTML, HTTP, and URI/URL; which remain the core of the web as we know it today.

Hope it helped! :)

Test if a number grade is an A (greater than or equal to 90). If so, print "Great!".

Hint: Grades may be decimals.

in python

Answers

Answer:

yes great

Explanation: sorry but I'm a little confused

grade = float(input("Enter your grade: "))

if grade >= 90:

   print("Great!")

I hope this helps!

2.10 LAB - Select employees and managers with inner join
The Employee table has the following columns:
• ID-integer, primary key
.
FirstName-variable-length string
• LastName-variable-length string
ManagerID - integer
.
Write a SELECT statement to show a list of all employees' first names and their managers' first names. List only employees that have a
manager. Order the results by Employee first name. Use aliases to give the result columns distinctly different names, like "Employee and
"Manager".
Hint: Join the Employee table to itself using INNER JOIN.

I have the code, however I have the employees as managers and the managers as the employees in the table. Here is the code I have.

SELECT emp.FirstName AS Employee, mgr.FirstName as Manager FROM Employee AS emp

INNER JOIN Employee AS mgr

ON emp.ID = mgr.ManagerID

ORDER BY mgr.ManagerID; no

2.10 LAB - Select employees and managers with inner joinThe Employee table has the following columns:

Answers

The statement to show a list of all employees' first names and their managers' first names is in explanation part.

What is SQL?

SQL is an abbreviation for Structured Query Language. SQL allows you to connect to and manipulate databases. SQL was adopted as an American National Standards Institute (ANSI) standard in 1986.

Here's an example SQL query to show a list of all employees' first names and their managers' first names, ordered by employee first name:

SELECT e1.FirstName AS Employee, e2.FirstName AS Manager

FROM Employee e1

INNER JOIN Employee e2

ON e1.ManagerID = e2.ID

ORDER BY Employee;

Thus, in this we order the results by the Employee column (i.e., the first name of the employee). The query only returns employees that have a manager (i.e., their ManagerID column is not null).

For more details regarding SQL, visit:

https://brainly.com/question/13068613

#SPJ9

John needs to create a presentation on programming languages. He begins with the earliest developed language. Which programming language
does John begin with?

A. machine language
B. assembly language
C. C++
D. Visual Basic

Answers

Answer:

Of the given choices, Assembly.

Explanation:

Assembly was one of the first fully flushed programming languages, built on paradigms built throughout the late 40's and early 50's.

FORTRAN however was the first programming language with a compiler.

Computer viruses and coding books

Answers

Is there a picture to go along with this? I don’t see one and an willing to help!

___________ is a global issue and there is a requirement to find out the interdependencies among the customers and suppliers.

Answers

Answer:

Supply chain disruption is a global issue and there is a requirement to find out the interdependencies among the customers and suppliers.

Explanation:

The context suggests we are discussing some type of challenge involving the relationships between customers, suppliers and a larger supply chain. A "global issue" involving "interdependencies among the customers and suppliers" points to potential supply chain disruption or issues in a supply network.

Since there is a "requirement to find out the interdependencies" between customers and suppliers, this suggests we need to identify and analyze how they are connected and dependent upon each other in order to resolve the broader "global issue." This information could then be used to make changes, build resilience or manage risks in the supply chain.

Hope this helps!

Answer:

Internet is global issues

Declare an eight by eight two-dimensional array of strings named chessboard.

Answers

Answer:SOLUTION:  

String [][] chessboard = new String [8][8];

Other Questions
WRITING ASSIGNMENT PLEASE HELPFINISHIf you're the type of person who believes everything will always work out for the best this is not the story for you (500 WORDS) NEED HELP ASAPPPPP!!!!!!!!!!!!!!!! PLEASE which of the following is an accurate description of food science Use elimination to solve the system of equations given by 3x - 2y = 10 and 5x + 2y = 6 i need help pleaseee!!! find the values of x and y in the figure the standard deviation of x is 1.08. if many households were selected at trandom, which of the following would be the best interpretation of the value 1.08?(a) The mean number of cars would be about 1.08.(b) The number of cars would typically be about 1.08 from the mean.(c) The number of cars would be at most 1.08 from the mean. a nurse is caring for four clients. after administering morning medications, she realizes that the nifedipine prescribed for one client was inadvertently administered to another client. which of the following actions should the nurse take first? What are the 2 non-human factors of production? Which of the basic data structures is the most suitable if you want to be able to insert elements in the middle in O(1)? A. Array B. Queue C. Linked list D. Stack T/F if the contract is not in writing, revenue cannot be recognized, even though goods have been transferred and payment is expected to be received in exchange. Which of the following is least likely to limit moral hazard? A.Policy limit B. Deductible C. Coinsurance requirement D. Compulsoryinsurance. Which of the following is an Arrhenius base?A) CH3CO2HB) LiOHC) CH3OHD) NaBrE) More than one of these compounds is an Arrhenius base 11Medieval Europe was ruled by the feudal system or feudalism. In feudalism nobles would give property, called a fief, toindividuals to use in exchange for a fee and protection. What term is used to describe those that received land fromnobles?A SerfsB VassalsC FieferD) Tenants List the following events in order from LOTF: I will give brainliest- The boys decide to start a signal fire.- Ralph, Simon and Jack head down the beach to explore the island. - One of the Choir boys faints.- The boys tease Piggy for his name- Ralph is voted chief of the boys on the island. Find the equation of the hyperboloid of one sheet passing through the points (5,0,0),(0,2,0) and (10,0,3),(0,4,3) =1 What are the 3 powers of government? Please HelpFind the radius of a circle whose diameter has endpoints (-3,-2) and K(7,8). what is the hardy-weinberg equation, it's five assumptions, and can populations of organisms evolve if hardy-weinberg equilibrium is met? Which age group will be the most receptive to education regarding nutrition, healthy snacks, and food choices water has a specitic hect capacity of 4200J/kg.How much heat energy must be supplied to raise the temperature of 1.5 kg of water by 10c