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
Zinaida [17]
2 years ago
6

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.int isSorted(int *array, int n){
Computers and Technology
1 answer:
Tanzania [10]2 years ago
4 0

Answer:

Here the code is given as follows,

Explanation:

Code:-

#include <stdio.h>  

int isSorted(int *array, int n) {

   if (n <= 1) {

       return 1;

   } else {

       return isSorted(array, n-1) && array[n-2] <= array[n-1];

   }

}  

int main() {

   int arr1[] = {3, 6, 7, 7, 12}, size1 = 5;

   int arr2[] = {3, 4, 9, 8}, size2 = 4;  

   printf("%d\n", isSorted(arr1, size1));

   printf("%d\n", isSorted(arr2, size2));

   return 0;

}

Output:-

You might be interested in
In order to prevent ports that are serving network hosts from being considered as best paths, what should be enabled to block bp
Sergio039 [100]

In order to prevent ports that are serving network hosts from being considered as best paths, BPDU guard should be enabled to block bpdus.

<h3>What are BPDU used for?</h3>

A bridge protocol data unit (BPDU) is known to be a kind of a data message that is known to be often  transmitted in a local area network to be able to know or find loops in that given network topologies.

Hence, in the case above, In order to prevent ports that are serving network hosts from being considered as best paths, BPDU guard should be enabled to block bpdus.

See full question below

. In order to prevent ports that are serving network hosts from being considered as best paths, what should be enabled to block BPDUs?

a. BPDU filter

b. BPDU guard

c. root guard

d. BPDU drop

Learn more about ports from

brainly.com/question/10097616

#SPJ1

6 0
1 year ago
Do you agree to the song that ''magtanim ay di biro?'' why?
iren [92.7K]

Answer:

I agree in this song because being a farmer is not easy you need to be hardwork

5 0
2 years ago
How do I get rid of this?
kherson [118]

There Is an App that you downloaded that allows this. you have to find it and disable it

3 0
3 years ago
Read 2 more answers
In order to protect your computer from the newest virus, which of the following should you do after you've installed a virus sca
grigory [225]
After the viruses would be detected we have to clean them.
means we have to erase the virus . 
6 0
3 years ago
Omar sends a PDF file to his teacher. He then prepares another copy of the presentation that includes only the slides he wants t
maria [59]

Answer:

D. Custom Slide Show

Explanation:

Correct on edg

7 0
3 years ago
Other questions:
  • Outline a scenario in which you might be acting ethically but might still want to remain anonymous while using the Internet. How
    14·1 answer
  • Assume the existence of a Window class with a function getWidth that returns the width of the window. Define a derived class Win
    15·1 answer
  • The isometric projection camera technique provides an illusion of perspective by using things like parallax scrolling to create
    10·1 answer
  • Create the Following Menu in a loop so the menu will continually show until the user chooses to exit.AddMultiplyExitAdd a value
    10·1 answer
  • To keep you from inadvertently moving controls as you work in the IDE, click the form or control, then click the _________ optio
    15·1 answer
  • To implement a small database, a database designer must know the "1" and the "M" sides of each relationship and whether the rela
    7·1 answer
  • Which of the following does not use a Graphic User Interface?
    14·1 answer
  • Here's a better picture of my pc mouse and keyboard​
    5·2 answers
  • Which button do you click to add up a series of numbers
    10·1 answer
  • Write an algorithm to show whether a given number is even or odd.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!