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]
3 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]3 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
Which of these is a neologism created as a result of the information age?
katrin [286]

The neologism created as a result of the information age is  Bromance (meaning "a male friendship").

<h3>What is  Neologism?</h3>

A neologism, is known to be a word, or phrase that tells or implies the process of an isolated thing entering common use, but have not been fully taken in by all.

Note that The neologism created as a result of the information age is  Bromance (meaning "a male friendship").

Learn more about neologism  from

brainly.com/question/9724482

#SPJ1

3 0
2 years ago
What are paragraphs separated by
Lemur [1.5K]

Paragraphs are usually separated by blank space.

Hope this is what you were looking for :)

6 0
3 years ago
The movement of the economy through highs and lows is referred to as:
skad [1K]

Answer:

the business cycle

Explanation:

5 0
3 years ago
(Giving away points!)
Komok [63]

Answer:

Used to lol not anymore tho :p

8 0
3 years ago
The collection of computer instructions and other files that constitute a piece of software is
lutik1710 [3]
The answer would be
A. Codebase

8 0
3 years ago
Read 2 more answers
Other questions:
  • If you are planning to carry a large balance on your credit card, which of the following credit card features should you look fo
    7·2 answers
  • Who does Potholes effect in South Africa?
    15·1 answer
  • Given a Fahrenheit value temperatureFahrenheit, write a statement that assigns temperatureCelsius with the equivalent Celsius va
    9·1 answer
  • ANYONE GOOD WITH CODING IN C++
    14·1 answer
  • A computer operating system software manufacturer invests its profits in creating newer versions of its operating system softwar
    7·1 answer
  • Write a program that takes the account's present value, monthly interest rate, and the number of months that the money will be l
    5·1 answer
  • With which type of test question should you leave yourself extra time to answer?
    14·2 answers
  • I need major help. Word processing
    14·1 answer
  • Hi am feeling really happy just passed a test after a lot of tries :-)
    5·1 answer
  • Integrity constraints are enforced by Group of answer choices A. The operating system B. The end user C. The database designer D
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!