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
Write a program to calculate and return total surface area of a box using FUNCTION _END FUNCTION.​
Andrei [34K]

Answer:

def funct1():

   h=int(input("Enter height of the box"))

   w=int(input("Enter the width of the box"))

   L=int(input("Enter the length of the box"))

   surface_area=2*(h*w + h*L + w*L)

   return surface_area

a=funct1()

print(a)

Explanation:

Please check the answer section.

6 0
3 years ago
___signs tell you what you can or can't do, and what you must do ?
Harrizon [31]

Answer:

Warning signs tell you can or can't do, and what you must do?

5 0
3 years ago
Read 2 more answers
What is the main fuction of command interpreter​
Vikentia [17]

The command interpreter or the command-line interface is one of the ways a user can interface with the operating system. The command interpreter's main task is to understands and executes commands which it turns into system calls. The kernel is the central module of an OS.

<em><u /></em>

<em><u>_________________</u></em>

<em><u /></em>

<em><u>Brainliest would be greatly appreciated!</u></em>

<em><u>I found this!</u></em>

<em><u>_________________</u></em>

<em><u /></em>

<em><u>#SpreadTheLove</u></em>

<em><u /></em>

<em><u>#SaveTheTrees</u></em>

<em><u /></em>

<em><u>- Mitsu JK</u></em>

6 0
3 years ago
What is the velocity of a 0.100kg car with a momentum of 5 kgm/s?
Cerrena [4.2K]

Answer:

v = 50 m/s

Explanation:

p = mv

5 = 0.1v

v = 50

4 0
2 years ago
How to reinstall windows 7 on my pc,without format,because i don't want to loose my data,and can u give me a windows 7 setup ple
Tems11 [23]
You could install it from a flash drive a disk.
5 0
3 years ago
Other questions:
  • "is it important to have a firewall on a home network
    10·1 answer
  • The systems development life cycle (SDLC) is the overall process of developing, implementing, and retiring information systems t
    9·1 answer
  • Service that connects on-premises software appliances with cloud based storage is ______
    10·1 answer
  • Your sister asks you if it is possible to get an office productivity suite for free. What do you tell her?
    13·1 answer
  • Both instructions and data in a digital<br>computer are represented as binary<br>digits. True False​
    13·1 answer
  • Exercise 3.6.9: 24 vs. "24"5 points
    7·1 answer
  • How i simplify this boolean expression ?A'.B'.C'+A'.B'.C+A'.B.C+A.B'.C+A.B.C
    6·2 answers
  • The most important preinstalled software is the ______ software that allows you to use the computer the first time you turn it o
    7·1 answer
  • 12. Why is it so important to pay attention to your digital reputation?
    14·1 answer
  • The process of getting listing information displayed on numerous other websites is:________
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!