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 cloud computing service model will enable an application developer to develop, manage, and test their applications without
musickatia [10]

Answer:

Platform as a Service (PaaS)

Explanation:

There are three broad cloud computing service model:

  1. Infrastructure as a Service(IaaS)
  2. Platform as a Service (PaaS)
  3. Software as a Service (SaaS)

Infrastructure-as-a-Service (IaaS) is a cloud-computing service model in which a vendor provides users access to computing resources such as servers, storage and networking.

Platform as a service (PaaS) is a cloud-computing service model that provides users (mostly application developer) with a cloud environment in which they can develop, manage and deliver applications. This is the required cloud computing service model for the case in question.

Software as a service (SaaS)  is a cloud-computing service model that provides users with access to a vendor’s cloud-based software. Users do not install applications on their local devices. Instead, the applications reside on a remote cloud network accessed through the web or an API.

3 0
3 years ago
What is the root of the tree?
Alexus [3.1K]

Answer:

root is an ancestor of all other nodes in a tree.

Explanation:

Root is a special node in the tree which is an ancestor of all other nodes.For example, consider a binary tree with root R. Let C1,C2 be the children of R at level 1. Similarly, C11,C12 are the children of C1 at level 2 and C21,C22 are the children of C2 at level 2. Now the parent of C22 is C2 and the parent of C2 is root R. Similar is the case for all other child nodes. Hence, Each node in the tree will have the root node R as its ancestor.

3 0
4 years ago
Nina is trying to learn more about how computers work. She has repeatedly read that the motherboard is the "brain” of the comput
Flauer [41]
The answer is c , Processes the data on the computer .
4 0
4 years ago
Read 2 more answers
Utility software includes which of the following ? <br> Select all that apply
svet-max [94.6K]

Answer:   Utility programs, commonly referred to as just "utilities," are software programs that add functionality to your computer or help your computer perform better. These include antivirus, backup, disk repair, file management, security, and networking programs.

Explanation:

7 0
3 years ago
In the terms of OOP, in the microwave system, current time is a BLANK and change heat is a BLANK
otez555 [7]

Answer:

1. Data and 2. procedures or functions

Explanation:

The object in an object oriented programming comprises of data and the procedures, The data describes the object, and the procedures explains what that particular object can do. And that is a function and nothing else. We declare a data, and procedure or function. We then initialize the data through constructor. And finally we does the operation like here its change heat by defining a function for it. A function is first declared, then defined and finally called for getting the desired output.

4 0
3 years ago
Other questions:
  • Exchanging which type of data uses the least bandwidth?
    14·1 answer
  • How do all apple phones work?
    7·1 answer
  • A coworker asks your opinion about how to minimize ActiveX attacks while she browses the Internet using Internet Explorer. The c
    14·1 answer
  • Plane eyes I don't know
    9·1 answer
  • What are the advantages to using a linked implementation as opposed to an array implementation?
    8·1 answer
  • LensForAll is a company that sells affordable contact lenses on its website. The CEO of the company realizes that an app must be
    9·1 answer
  • Software que busca, detecta y elimina malware tipo espía; puede instalarse en la computadora de manera aislada o en conjunto con
    11·1 answer
  • Converting denary no 41 to binar
    12·1 answer
  • Which is an advantage of using a flat file instead of a relational database?
    5·1 answer
  • List four safety factors that must be considered when building mine shaft headgear model
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!