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
miss Akunina [59]
3 years ago
13

Write a recursive function that returns 1 if an array of size n is in sorted order and 0 otherwise. Note: If array a stores 3, 6

, 7, 7, 12, then isSorted(a, 5) should return 1 . If array b stores 3, 4, 9, 8, then isSorted(b, 4) should return 0.
Computers and Technology
1 answer:
galina1969 [7]3 years ago
6 0

Answer:

The function in C++ is as follows:

int isSorted(int ar[], int n){

if (n == 1 || n == 0){

 return 1;}

if (ar[n - 1] < ar[n - 2]){

 return 0;}

return isSorted(ar, n - 1);}

Explanation:

This defines the function

int isSorted(int ar[], int n){

This represents the base case; n = 1 or 0 will return 1 (i.e. the array is sorted)

if (n == 1 || n == 0){

 return 1;}

This checks if the current element is less than the previous array element; If yes, the array is not sorted

if (ar[n - 1] < ar[n - 2]){

 return 0;}

This calls the function, recursively

return isSorted(ar, n - 1);

}

You might be interested in
Is www part of every url address?
melisa1 [442]
The correct answer is that WWW. is universal, meaning that any and all url addresses start and have www.

My reasoning is that if you were to look up, lets say google, do :

www.(google).com ( remove parentheses )

then

google.com 

You come up with the same results THUS YOUR CORRECT ANSWER IS YES! ALL URL ADDRESS HAVE AND CONTAIN WWW.!!!

5 0
4 years ago
An organization is deploying a new system to the production environment. A security analyst discovers the system is not properly
Alisiya [41]

Answer:

The best answer is A) A secure baseline was not established early in the process.

Explanation:

If the organization is deploying to the production environment and the security analyst discovers this risk at this point, then a secure baseline was not established, because it is impossible to successfully pass the coding and peer review instances by programmers and testing instances by the QA team without any warning to correct this problem.

5 0
4 years ago
_______ refers to physical computer equipment, such as the computer monitor, central processing unit, or keyboard.
lesya692 [45]
The Hardware refers to the physical computer equipment, such as the monitor, keyboard, mouse etc.
5 0
3 years ago
A) Internet is owned by:
Vesna [10]

Answer:

D. Nobody owns internet

6 0
3 years ago
What does decimal 88 equal in binary. Explain and show your work for full marks.
lara31 [8.8K]

Answer:

01011000

Explanation:

Binary 01011000

Decimal 88

Hexadecimal 58

Bits 8

Equation 64 + 16 + 8

8 0
3 years ago
Read 2 more answers
Other questions:
  • A bunch of computer scientists take over an island and start their own country. They want the license plates to use binary numbe
    11·1 answer
  • To activate a wizard to help in creating combo boxes and command buttons, make sure the ____ button is selected
    6·1 answer
  • A power supply unit for a computer converts:
    7·1 answer
  • Naruto Uzumaki who likes naruto ??? who waches it??
    14·2 answers
  • In an inspection, usually the first thing an inspector will want to see is:
    14·2 answers
  • Intellectual ______ is the legal term for ownership of intangible assets such as ideas, art, music, movies, and software.
    13·2 answers
  • The __________ on a mouse is used to select or place the cursor where you want on the page
    13·1 answer
  • Name the box where the name of the first cell of the selected range appears?
    7·1 answer
  • What's wrong with my program? Here is my code , if the user wants a 3rd card dealt they, have to select yes and the total will b
    7·1 answer
  • How do you properly turn off a computer?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!